mirror of https://github.com/apache/lucene.git
SOLR-5914: Merge branch up to trunk, make all tests pass, make some other improvements and small changes.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/solr5914@1582571 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
688addbd50
commit
48c5ea550f
|
@ -787,6 +787,24 @@ public final class TestUtil {
|
||||||
* an exception (typically on Windows).
|
* an exception (typically on Windows).
|
||||||
*/
|
*/
|
||||||
public static File createTempDir(String name) {
|
public static File createTempDir(String name) {
|
||||||
|
return createTempDir(name, new File(System.getProperty("tempDir", System.getProperty("java.io.tmpdir"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new, empty temporary folder, based on the given name. The folder will be
|
||||||
|
* deleted at the end of the suite. Failure to delete the temporary folder will cause
|
||||||
|
* an exception (typically on Windows).
|
||||||
|
*/
|
||||||
|
public static File createTempDir(String name, File tmpDir) {
|
||||||
|
return createTempDir(name, tmpDir, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new, empty temporary folder, based on the given name. The folder will be
|
||||||
|
* deleted at the end of the suite. Failure to delete the temporary folder will cause
|
||||||
|
* an exception (typically on Windows).
|
||||||
|
*/
|
||||||
|
public static File createTempDir(String name, File tmpDir, boolean ensureCleanedUp) {
|
||||||
if (name.length() < 3) {
|
if (name.length() < 3) {
|
||||||
throw new IllegalArgumentException("description must be at least 3 characters");
|
throw new IllegalArgumentException("description must be at least 3 characters");
|
||||||
}
|
}
|
||||||
|
@ -797,18 +815,18 @@ public final class TestUtil {
|
||||||
// does not affect the randomness of the test.
|
// does not affect the randomness of the test.
|
||||||
final Random random = new Random(RandomizedContext.current().getRandom().nextLong());
|
final Random random = new Random(RandomizedContext.current().getRandom().nextLong());
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
String tmpDir = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
|
|
||||||
File f;
|
File f;
|
||||||
do {
|
do {
|
||||||
f = genTempFile(random, name + "_", "", new File(tmpDir));
|
f = genTempFile(random, name + "_", "", tmpDir);
|
||||||
} while (!f.mkdir() && (attempt++) < GET_TEMP_DIR_RETRY_THRESHOLD);
|
} while (!f.mkdir() && (attempt++) < GET_TEMP_DIR_RETRY_THRESHOLD);
|
||||||
|
|
||||||
if (attempt > GET_TEMP_DIR_RETRY_THRESHOLD) {
|
if (attempt > GET_TEMP_DIR_RETRY_THRESHOLD) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"failed to get a temporary dir too many times. check your temp directory and consider manually cleaning it.");
|
"failed to get a temporary dir too many times. check your temp directory and consider manually cleaning it.");
|
||||||
}
|
}
|
||||||
|
if (ensureCleanedUp) {
|
||||||
LuceneTestCase.closeAfterSuite(new CloseableFile(f, LuceneTestCase.suiteFailureMarker));
|
LuceneTestCase.closeAfterSuite(new CloseableFile(f, LuceneTestCase.suiteFailureMarker));
|
||||||
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,13 +63,9 @@ public class TestICUCollationField extends SolrTestCaseJ4 {
|
||||||
* So its preferable to create this file on-the-fly.
|
* So its preferable to create this file on-the-fly.
|
||||||
*/
|
*/
|
||||||
public static String setupSolrHome() throws Exception {
|
public static String setupSolrHome() throws Exception {
|
||||||
// make a solr home underneath the test's TEMP_DIR
|
String tmpFile = createTempDir().getAbsolutePath();
|
||||||
File tmpFile = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
tmpFile.delete();
|
|
||||||
tmpFile.mkdir();
|
|
||||||
|
|
||||||
// make data and conf dirs
|
// make data and conf dirs
|
||||||
new File(tmpFile + "/collection1", "data").mkdirs();
|
new File(tmpFile + "/collection1", "data").mkdirs();
|
||||||
File confDir = new File(tmpFile + "/collection1", "conf");
|
File confDir = new File(tmpFile + "/collection1", "conf");
|
||||||
confDir.mkdirs();
|
confDir.mkdirs();
|
||||||
|
|
||||||
|
@ -91,7 +87,7 @@ public class TestICUCollationField extends SolrTestCaseJ4 {
|
||||||
IOUtils.write(tailoredRules, os, "UTF-8");
|
IOUtils.write(tailoredRules, os, "UTF-8");
|
||||||
os.close();
|
os.close();
|
||||||
|
|
||||||
return tmpFile.getAbsolutePath();
|
return tmpFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,10 +65,7 @@ public class TestICUCollationFieldDocValues extends SolrTestCaseJ4 {
|
||||||
* So its preferable to create this file on-the-fly.
|
* So its preferable to create this file on-the-fly.
|
||||||
*/
|
*/
|
||||||
public static String setupSolrHome() throws Exception {
|
public static String setupSolrHome() throws Exception {
|
||||||
// make a solr home underneath the test's TEMP_DIR
|
File tmpFile = createTempDir();
|
||||||
File tmpFile = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
tmpFile.delete();
|
|
||||||
tmpFile.mkdir();
|
|
||||||
|
|
||||||
// make data and conf dirs
|
// make data and conf dirs
|
||||||
new File(tmpFile + "/collection1", "data").mkdirs();
|
new File(tmpFile + "/collection1", "data").mkdirs();
|
||||||
|
|
|
@ -56,10 +56,11 @@ public abstract class AbstractSqlEntityProcessorTestCase extends
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void beforeSqlEntitiyProcessorTestCase() throws Exception {
|
public void beforeSqlEntitiyProcessorTestCase() throws Exception {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = createTempDir();
|
||||||
fileLocation = tmpdir.getPath();
|
fileLocation = tmpdir.getPath();
|
||||||
fileName = "the.properties";
|
fileName = "the.properties";
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void afterSqlEntitiyProcessorTestCase() {
|
public void afterSqlEntitiyProcessorTestCase() {
|
||||||
useSimpleCaches = false;
|
useSimpleCaches = false;
|
||||||
|
|
|
@ -151,7 +151,8 @@ public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCa
|
||||||
|
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
File home = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File home = new File(dataDir,
|
||||||
|
getClass().getName() + "-" + System.currentTimeMillis());
|
||||||
|
|
||||||
homeDir = new File(home, "inst");
|
homeDir = new File(home, "inst");
|
||||||
dataDir = new File(homeDir + "/collection1", "data");
|
dataDir = new File(homeDir + "/collection1", "data");
|
||||||
|
|
|
@ -16,18 +16,15 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.solr.handler.dataimport;
|
package org.apache.solr.handler.dataimport;
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
import java.io.File;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.File;
|
|
||||||
|
import org.apache.solr.request.LocalSolrQueryRequest;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -242,7 +239,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
||||||
@Test
|
@Test
|
||||||
@Ignore("Fix Me. See SOLR-4103.")
|
@Ignore("Fix Me. See SOLR-4103.")
|
||||||
public void testFileListEntityProcessor_lastIndexTime() throws Exception {
|
public void testFileListEntityProcessor_lastIndexTime() throws Exception {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = File.createTempFile("test", "tmp", createTempDir());
|
||||||
|
|
||||||
Map<String, String> params = createMap("baseDir", tmpdir.getAbsolutePath());
|
Map<String, String> params = createMap("baseDir", tmpdir.getAbsolutePath());
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testSimple() throws IOException {
|
public void testSimple() throws IOException {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = createTempDir();
|
||||||
|
|
||||||
createFile(tmpdir, "a.xml", "a.xml".getBytes("UTF-8"), false);
|
createFile(tmpdir, "a.xml", "a.xml".getBytes("UTF-8"), false);
|
||||||
createFile(tmpdir, "b.xml", "b.xml".getBytes("UTF-8"), false);
|
createFile(tmpdir, "b.xml", "b.xml".getBytes("UTF-8"), false);
|
||||||
createFile(tmpdir, "c.props", "c.props".getBytes("UTF-8"), false);
|
createFile(tmpdir, "c.props", "c.props".getBytes("UTF-8"), false);
|
||||||
|
@ -62,7 +63,10 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBiggerSmallerFiles() throws IOException {
|
public void testBiggerSmallerFiles() throws IOException {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = File.createTempFile("test", "tmp", createTempDir());
|
||||||
|
tmpdir.delete();
|
||||||
|
tmpdir.mkdir();
|
||||||
|
|
||||||
long minLength = Long.MAX_VALUE;
|
long minLength = Long.MAX_VALUE;
|
||||||
String smallestFile = "";
|
String smallestFile = "";
|
||||||
byte[] content = "abcdefgij".getBytes("UTF-8");
|
byte[] content = "abcdefgij".getBytes("UTF-8");
|
||||||
|
@ -129,7 +133,8 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNTOT() throws IOException {
|
public void testNTOT() throws IOException {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = createTempDir();
|
||||||
|
|
||||||
createFile(tmpdir, "a.xml", "a.xml".getBytes("UTF-8"), true);
|
createFile(tmpdir, "a.xml", "a.xml".getBytes("UTF-8"), true);
|
||||||
createFile(tmpdir, "b.xml", "b.xml".getBytes("UTF-8"), true);
|
createFile(tmpdir, "b.xml", "b.xml".getBytes("UTF-8"), true);
|
||||||
createFile(tmpdir, "c.props", "c.props".getBytes("UTF-8"), true);
|
createFile(tmpdir, "c.props", "c.props".getBytes("UTF-8"), true);
|
||||||
|
@ -162,8 +167,9 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRECURSION() throws IOException {
|
public void testRECURSION() throws IOException {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = createTempDir();
|
||||||
File childdir = new File(tmpdir + "/child" );
|
File childdir = new File(tmpdir + "/child" );
|
||||||
|
childdir.mkdir();
|
||||||
createFile(childdir, "a.xml", "a.xml".getBytes("UTF-8"), true);
|
createFile(childdir, "a.xml", "a.xml".getBytes("UTF-8"), true);
|
||||||
createFile(childdir, "b.xml", "b.xml".getBytes("UTF-8"), true);
|
createFile(childdir, "b.xml", "b.xml".getBytes("UTF-8"), true);
|
||||||
createFile(childdir, "c.props", "c.props".getBytes("UTF-8"), true);
|
createFile(childdir, "c.props", "c.props".getBytes("UTF-8"), true);
|
||||||
|
|
|
@ -16,17 +16,15 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.solr.handler.dataimport;
|
package org.apache.solr.handler.dataimport;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestNonWritablePersistFile extends AbstractDataImportHandlerTestCase {
|
public class TestNonWritablePersistFile extends AbstractDataImportHandlerTestCase {
|
||||||
private static final String FULLIMPORT_QUERY = "select * from x";
|
private static final String FULLIMPORT_QUERY = "select * from x";
|
||||||
|
|
||||||
|
@ -54,8 +52,7 @@ public class TestNonWritablePersistFile extends AbstractDataImportHandlerTestCas
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void createTempSolrHomeAndCore() throws Exception {
|
public static void createTempSolrHomeAndCore() throws Exception {
|
||||||
createTempDir();
|
tmpSolrHome = createTempDir().getAbsolutePath();
|
||||||
tmpSolrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
|
||||||
FileUtils.copyDirectory(getFile("dih/solr"), new File(tmpSolrHome).getAbsoluteFile());
|
FileUtils.copyDirectory(getFile("dih/solr"), new File(tmpSolrHome).getAbsoluteFile());
|
||||||
initCore("dataimport-solrconfig.xml", "dataimport-schema.xml",
|
initCore("dataimport-solrconfig.xml", "dataimport-schema.xml",
|
||||||
new File(tmpSolrHome).getAbsolutePath());
|
new File(tmpSolrHome).getAbsolutePath());
|
||||||
|
|
|
@ -6,16 +6,11 @@ import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -48,7 +43,9 @@ public class TestSimplePropertiesWriter extends AbstractDIHJdbcTestCase {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void spwBefore() throws Exception {
|
public void spwBefore() throws Exception {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = File.createTempFile("test", "tmp", createTempDir());
|
||||||
|
tmpdir.delete();
|
||||||
|
tmpdir.mkdir();
|
||||||
fileLocation = tmpdir.getPath();
|
fileLocation = tmpdir.getPath();
|
||||||
fileName = "the.properties";
|
fileName = "the.properties";
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||||
|
@ -306,7 +304,7 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTe
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataDir() {
|
public String getDataDir() {
|
||||||
return dataDir.toString();
|
return initCoreDataDir.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSolrConfigFile() {
|
public String getSolrConfigFile() {
|
||||||
|
@ -318,14 +316,13 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
File home = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
String home = createTempDir().getAbsolutePath();
|
||||||
|
homeDir = new File(home + "inst");
|
||||||
homeDir = new File(home + "inst");
|
initCoreDataDir = new File(homeDir + "/collection1", "data");
|
||||||
dataDir = new File(homeDir + "/collection1", "data");
|
|
||||||
confDir = new File(homeDir + "/collection1", "conf");
|
confDir = new File(homeDir + "/collection1", "conf");
|
||||||
|
|
||||||
homeDir.mkdirs();
|
homeDir.mkdirs();
|
||||||
dataDir.mkdirs();
|
initCoreDataDir.mkdirs();
|
||||||
confDir.mkdirs();
|
confDir.mkdirs();
|
||||||
|
|
||||||
FileUtils.copyFile(getFile(getSolrXmlFile()), new File(homeDir, "solr.xml"));
|
FileUtils.copyFile(getFile(getSolrXmlFile()), new File(homeDir, "solr.xml"));
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.solr.handler.dataimport;
|
package org.apache.solr.handler.dataimport;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
@ -29,6 +25,8 @@ import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Test for XPathEntityProcessor
|
* Test for XPathEntityProcessor
|
||||||
|
@ -44,7 +42,8 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void withFieldsAndXpath() throws Exception {
|
public void withFieldsAndXpath() throws Exception {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = createTempDir();
|
||||||
|
|
||||||
createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"), false);
|
createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"), false);
|
||||||
Map entityAttrs = createMap("name", "e", "url", "cd.xml",
|
Map entityAttrs = createMap("name", "e", "url", "cd.xml",
|
||||||
XPathEntityProcessor.FOR_EACH, "/catalog/cd");
|
XPathEntityProcessor.FOR_EACH, "/catalog/cd");
|
||||||
|
@ -332,8 +331,12 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void withDefaultSolrAndXsl() throws Exception {
|
public void withDefaultSolrAndXsl() throws Exception {
|
||||||
File tmpdir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpdir = File.createTempFile("test", "tmp", createTempDir());
|
||||||
AbstractDataImportHandlerTestCase.createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"), false);
|
tmpdir.delete();
|
||||||
|
tmpdir.mkdir();
|
||||||
|
AbstractDataImportHandlerTestCase.createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"),
|
||||||
|
false);
|
||||||
|
|
||||||
Map entityAttrs = createMap("name", "e",
|
Map entityAttrs = createMap("name", "e",
|
||||||
XPathEntityProcessor.USE_SOLR_ADD_SCHEMA, "true", "xsl", ""
|
XPathEntityProcessor.USE_SOLR_ADD_SCHEMA, "true", "xsl", ""
|
||||||
+ new File(tmpdir, "x.xsl").toURI(), "url", "cd.xml");
|
+ new File(tmpdir, "x.xsl").toURI(), "url", "cd.xml");
|
||||||
|
|
|
@ -50,8 +50,7 @@ public class TestZKPropertiesWriter extends AbstractDataImportHandlerTestCase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void dihZk_beforeClass() throws Exception {
|
public static void dihZk_beforeClass() throws Exception {
|
||||||
createTempDir();
|
zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
zkServer.run();
|
zkServer.run();
|
||||||
|
|
|
@ -21,8 +21,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.hadoop.morphline.MorphlineMapRunner;
|
import org.apache.solr.hadoop.morphline.MorphlineMapRunner;
|
||||||
import org.apache.solr.morphlines.solr.AbstractSolrMorphlineTestBase;
|
import org.apache.solr.morphlines.solr.AbstractSolrMorphlineTestBase;
|
||||||
|
@ -47,7 +45,9 @@ public abstract class MRUnitBase extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupHadoopConfig(Configuration config) throws IOException {
|
protected void setupHadoopConfig(Configuration config) throws IOException {
|
||||||
String tempDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
|
||||||
|
String tempDir = createTempDir().getAbsolutePath();
|
||||||
|
|
||||||
FileUtils.copyFile(new File(RESOURCES_DIR + "/custom-mimetypes.xml"), new File(tempDir + "/custom-mimetypes.xml"));
|
FileUtils.copyFile(new File(RESOURCES_DIR + "/custom-mimetypes.xml"), new File(tempDir + "/custom-mimetypes.xml"));
|
||||||
|
|
||||||
AbstractSolrMorphlineTestBase.setupMorphline(tempDir, "test-morphlines/solrCellDocumentTypes", true);
|
AbstractSolrMorphlineTestBase.setupMorphline(tempDir, "test-morphlines/solrCellDocumentTypes", true);
|
||||||
|
|
|
@ -27,8 +27,6 @@ import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.lucene.util.Constants;
|
import org.apache.lucene.util.Constants;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.cloud.AbstractZkTestCase;
|
import org.apache.solr.cloud.AbstractZkTestCase;
|
||||||
import org.apache.solr.hadoop.dedup.NoChangeUpdateConflictResolver;
|
import org.apache.solr.hadoop.dedup.NoChangeUpdateConflictResolver;
|
||||||
|
@ -57,12 +55,11 @@ public class MapReduceIndexerToolArgumentParserTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MapReduceIndexerToolArgumentParserTest.class);
|
private static final Logger LOG = LoggerFactory.getLogger(MapReduceIndexerToolArgumentParserTest.class);
|
||||||
|
|
||||||
private static File solrHomeDirectory;
|
private final File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() {
|
public static void beforeClass() {
|
||||||
assumeFalse("Does not work on Windows, because it uses UNIX shell commands or POSIX paths", Constants.WINDOWS);
|
assumeFalse("Does not work on Windows, because it uses UNIX shell commands or POSIX paths", Constants.WINDOWS);
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -38,8 +38,6 @@ import org.apache.hadoop.util.JarFinder;
|
||||||
import org.apache.hadoop.util.ToolRunner;
|
import org.apache.hadoop.util.ToolRunner;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.lucene.util.Constants;
|
import org.apache.lucene.util.Constants;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.cloud.AbstractZkTestCase;
|
import org.apache.solr.cloud.AbstractZkTestCase;
|
||||||
|
@ -81,7 +79,7 @@ public class MorphlineBasicMiniMRTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static String tempDir;
|
private static String tempDir;
|
||||||
|
|
||||||
private static File solrHomeDirectory;
|
private static final File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
protected MapReduceIndexerTool createTool() {
|
protected MapReduceIndexerTool createTool() {
|
||||||
return new MapReduceIndexerTool();
|
return new MapReduceIndexerTool();
|
||||||
|
@ -110,7 +108,6 @@ public class MorphlineBasicMiniMRTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
|
|
||||||
assumeTrue(
|
assumeTrue(
|
||||||
"Currently this test can only be run without the lucene test security policy in place",
|
"Currently this test can only be run without the lucene test security policy in place",
|
||||||
|
@ -125,8 +122,8 @@ public class MorphlineBasicMiniMRTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
AbstractZkTestCase.SOLRHOME = solrHomeDirectory;
|
AbstractZkTestCase.SOLRHOME = solrHomeDirectory;
|
||||||
FileUtils.copyDirectory(MINIMR_CONF_DIR, solrHomeDirectory);
|
FileUtils.copyDirectory(MINIMR_CONF_DIR, solrHomeDirectory);
|
||||||
|
File dataDir = createTempDir();
|
||||||
tempDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
tempDir = dataDir.getAbsolutePath();
|
||||||
new File(tempDir).mkdirs();
|
new File(tempDir).mkdirs();
|
||||||
FileUtils.copyFile(new File(RESOURCES_DIR + "/custom-mimetypes.xml"), new File(tempDir + "/custom-mimetypes.xml"));
|
FileUtils.copyFile(new File(RESOURCES_DIR + "/custom-mimetypes.xml"), new File(tempDir + "/custom-mimetypes.xml"));
|
||||||
|
|
||||||
|
@ -144,7 +141,6 @@ public class MorphlineBasicMiniMRTest extends SolrTestCaseJ4 {
|
||||||
// sb.append(",").append(i.getCanonicalHostName());
|
// sb.append(",").append(i.getCanonicalHostName());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
createTempDir();
|
|
||||||
new File(dataDir, "nm-local-dirs").mkdirs();
|
new File(dataDir, "nm-local-dirs").mkdirs();
|
||||||
|
|
||||||
System.setProperty("solr.hdfs.blockcache.enabled", "false");
|
System.setProperty("solr.hdfs.blockcache.enabled", "false");
|
||||||
|
|
|
@ -43,8 +43,6 @@ import org.apache.hadoop.util.JarFinder;
|
||||||
import org.apache.hadoop.util.ToolRunner;
|
import org.apache.hadoop.util.ToolRunner;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.lucene.util.Constants;
|
import org.apache.lucene.util.Constants;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
||||||
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
|
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
|
||||||
|
@ -110,7 +108,7 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
|
||||||
private final String inputAvroFile2;
|
private final String inputAvroFile2;
|
||||||
private final String inputAvroFile3;
|
private final String inputAvroFile3;
|
||||||
|
|
||||||
private static File solrHomeDirectory;
|
private static final File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSolrHome() {
|
public String getSolrHome() {
|
||||||
|
@ -140,17 +138,18 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
|
||||||
assumeFalse("FIXME: This test fails under Java 8 due to the Saxon dependency - see SOLR-1301", Constants.JRE_IS_MINIMUM_JAVA8);
|
assumeFalse("FIXME: This test fails under Java 8 due to the Saxon dependency - see SOLR-1301", Constants.JRE_IS_MINIMUM_JAVA8);
|
||||||
assumeFalse("FIXME: This test fails under J9 due to the Saxon dependency - see SOLR-1301", System.getProperty("java.vm.info", "<?>").contains("IBM J9"));
|
assumeFalse("FIXME: This test fails under J9 due to the Saxon dependency - see SOLR-1301", System.getProperty("java.vm.info", "<?>").contains("IBM J9"));
|
||||||
|
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
AbstractZkTestCase.SOLRHOME = solrHomeDirectory;
|
AbstractZkTestCase.SOLRHOME = solrHomeDirectory;
|
||||||
FileUtils.copyDirectory(MINIMR_INSTANCE_DIR, AbstractZkTestCase.SOLRHOME);
|
FileUtils.copyDirectory(MINIMR_INSTANCE_DIR, AbstractZkTestCase.SOLRHOME);
|
||||||
|
tempDir = createTempDir().getAbsolutePath();
|
||||||
|
|
||||||
|
new File(tempDir).mkdirs();
|
||||||
|
|
||||||
tempDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
|
||||||
FileUtils.copyFile(new File(RESOURCES_DIR + "/custom-mimetypes.xml"), new File(tempDir + "/custom-mimetypes.xml"));
|
FileUtils.copyFile(new File(RESOURCES_DIR + "/custom-mimetypes.xml"), new File(tempDir + "/custom-mimetypes.xml"));
|
||||||
|
|
||||||
AbstractSolrMorphlineTestBase.setupMorphline(tempDir, "test-morphlines/solrCellDocumentTypes", true);
|
AbstractSolrMorphlineTestBase.setupMorphline(tempDir, "test-morphlines/solrCellDocumentTypes", true);
|
||||||
|
|
||||||
|
|
||||||
System.setProperty("hadoop.log.dir", new File(dataDir, "logs").getAbsolutePath());
|
System.setProperty("hadoop.log.dir", new File(tempDir, "logs").getAbsolutePath());
|
||||||
|
|
||||||
int taskTrackers = 2;
|
int taskTrackers = 2;
|
||||||
int dataNodes = 2;
|
int dataNodes = 2;
|
||||||
|
@ -162,16 +161,15 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
|
||||||
conf.set("dfs.permissions", "true");
|
conf.set("dfs.permissions", "true");
|
||||||
conf.set("hadoop.security.authentication", "simple");
|
conf.set("hadoop.security.authentication", "simple");
|
||||||
|
|
||||||
conf.set(YarnConfiguration.NM_LOCAL_DIRS, dataDir + File.separator + "nm-local-dirs");
|
conf.set(YarnConfiguration.NM_LOCAL_DIRS, tempDir + File.separator + "nm-local-dirs");
|
||||||
conf.set(YarnConfiguration.DEFAULT_NM_LOG_DIRS, dataDir + File.separator + "nm-logs");
|
conf.set(YarnConfiguration.DEFAULT_NM_LOG_DIRS, tempDir + File.separator + "nm-logs");
|
||||||
|
|
||||||
|
|
||||||
createTempDir();
|
new File(tempDir + File.separator + "nm-local-dirs").mkdirs();
|
||||||
new File(dataDir + File.separator + "nm-local-dirs").mkdirs();
|
|
||||||
|
|
||||||
System.setProperty("test.build.dir", dataDir + File.separator + "hdfs" + File.separator + "test-build-dir");
|
System.setProperty("test.build.dir", tempDir + File.separator + "hdfs" + File.separator + "test-build-dir");
|
||||||
System.setProperty("test.build.data", dataDir + File.separator + "hdfs" + File.separator + "build");
|
System.setProperty("test.build.data", tempDir + File.separator + "hdfs" + File.separator + "build");
|
||||||
System.setProperty("test.cache.data", dataDir + File.separator + "hdfs" + File.separator + "cache");
|
System.setProperty("test.cache.data", tempDir + File.separator + "hdfs" + File.separator + "cache");
|
||||||
|
|
||||||
dfsCluster = new MiniDFSCluster(conf, dataNodes, true, null);
|
dfsCluster = new MiniDFSCluster(conf, dataNodes, true, null);
|
||||||
FileSystem fileSystem = dfsCluster.getFileSystem();
|
FileSystem fileSystem = dfsCluster.getFileSystem();
|
||||||
|
@ -185,7 +183,7 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
|
||||||
fileSystem.setPermission(new Path("/hadoop/mapred/system"),
|
fileSystem.setPermission(new Path("/hadoop/mapred/system"),
|
||||||
FsPermission.valueOf("-rwx------"));
|
FsPermission.valueOf("-rwx------"));
|
||||||
|
|
||||||
mrCluster = MiniMRClientClusterFactory.create(MorphlineGoLiveMiniMRTest.class, 1, conf, new File(dataDir, "mrCluster"));
|
mrCluster = MiniMRClientClusterFactory.create(MorphlineGoLiveMiniMRTest.class, 1, conf, new File(tempDir, "mrCluster"));
|
||||||
|
|
||||||
//new MiniMRCluster(0, 0, taskTrackers, nnURI, numDirs, racks,
|
//new MiniMRCluster(0, 0, taskTrackers, nnURI, numDirs, racks,
|
||||||
//hosts, null, conf);
|
//hosts, null, conf);
|
||||||
|
|
|
@ -32,8 +32,6 @@ import java.util.TimeZone;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
|
@ -120,7 +118,7 @@ public class AbstractSolrMorphlineTestBase extends SolrTestCaseJ4 {
|
||||||
testServer = new SolrServerDocumentLoader(solrServer, batchSize);
|
testServer = new SolrServerDocumentLoader(solrServer, batchSize);
|
||||||
deleteAllDocuments();
|
deleteAllDocuments();
|
||||||
|
|
||||||
tempDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
tempDir = createTempDir().getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
|
import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
|
||||||
|
@ -33,9 +32,8 @@ import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.kitesdk.morphline.api.Command;
|
|
||||||
import org.kitesdk.morphline.api.Collector;
|
import org.kitesdk.morphline.api.Collector;
|
||||||
|
import org.kitesdk.morphline.api.Command;
|
||||||
import org.kitesdk.morphline.api.MorphlineContext;
|
import org.kitesdk.morphline.api.MorphlineContext;
|
||||||
import org.kitesdk.morphline.api.Record;
|
import org.kitesdk.morphline.api.Record;
|
||||||
import org.kitesdk.morphline.base.Compiler;
|
import org.kitesdk.morphline.base.Compiler;
|
||||||
|
@ -48,8 +46,8 @@ import com.google.common.collect.ListMultimap;
|
||||||
import com.typesafe.config.Config;
|
import com.typesafe.config.Config;
|
||||||
|
|
||||||
public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistribZkTestBase {
|
public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistribZkTestBase {
|
||||||
private static File solrHomeDirectory;
|
private static final File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
protected static final String RESOURCES_DIR = getFile("morphlines-core.marker").getParent();
|
protected static final String RESOURCES_DIR = getFile("morphlines-core.marker").getParent();
|
||||||
private static final File SOLR_INSTANCE_DIR = new File(RESOURCES_DIR + "/solr");
|
private static final File SOLR_INSTANCE_DIR = new File(RESOURCES_DIR + "/solr");
|
||||||
private static final File SOLR_CONF_DIR = new File(RESOURCES_DIR + "/solr/collection1");
|
private static final File SOLR_CONF_DIR = new File(RESOURCES_DIR + "/solr/collection1");
|
||||||
|
@ -70,10 +68,8 @@ public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistri
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
solrHomeDirectory = TestUtil.createTempDir(AbstractSolrMorphlineZkTestBase.class.getName());
|
|
||||||
AbstractZkTestCase.SOLRHOME = solrHomeDirectory;
|
AbstractZkTestCase.SOLRHOME = solrHomeDirectory;
|
||||||
FileUtils.copyDirectory(SOLR_INSTANCE_DIR, solrHomeDirectory);
|
FileUtils.copyDirectory(SOLR_INSTANCE_DIR, solrHomeDirectory);
|
||||||
createTempDir();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,8 +17,10 @@ package org.apache.solr;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
|
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
|
||||||
|
@ -30,9 +32,6 @@ import org.apache.solr.core.SolrCore;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class AnalysisAfterCoreReloadTest extends SolrTestCaseJ4 {
|
public class AnalysisAfterCoreReloadTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static String tmpSolrHome;
|
private static String tmpSolrHome;
|
||||||
|
@ -43,8 +42,7 @@ public class AnalysisAfterCoreReloadTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
createTempDir();
|
tmpSolrHome = createTempDir().getAbsolutePath();
|
||||||
tmpSolrHome = TestUtil.createTempDir(AnalysisAfterCoreReloadTest.class.getSimpleName()).getAbsolutePath();
|
|
||||||
FileUtils.copyDirectory(new File(TEST_HOME()), new File(tmpSolrHome).getAbsoluteFile());
|
FileUtils.copyDirectory(new File(TEST_HOME()), new File(tmpSolrHome).getAbsoluteFile());
|
||||||
initCore("solrconfig.xml", "schema.xml", new File(tmpSolrHome).getAbsolutePath());
|
initCore("solrconfig.xml", "schema.xml", new File(tmpSolrHome).getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,13 @@ package org.apache.solr;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
|
|
||||||
public class SolrTestCaseJ4Test extends SolrTestCaseJ4 {
|
public class SolrTestCaseJ4Test extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
|
@ -35,8 +33,7 @@ public class SolrTestCaseJ4Test extends SolrTestCaseJ4 {
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
// Create a temporary directory that holds a core NOT named "collection1". Use the smallest configuration sets
|
// Create a temporary directory that holds a core NOT named "collection1". Use the smallest configuration sets
|
||||||
// we can so we don't copy that much junk around.
|
// we can so we don't copy that much junk around.
|
||||||
createTempDir();
|
tmpSolrHome = createTempDir().getAbsolutePath();
|
||||||
tmpSolrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
|
||||||
|
|
||||||
File subHome = new File(new File(tmpSolrHome, "core0"), "conf");
|
File subHome = new File(new File(tmpSolrHome, "core0"), "conf");
|
||||||
assertTrue("Failed to make subdirectory ", subHome.mkdirs());
|
assertTrue("Failed to make subdirectory ", subHome.mkdirs());
|
||||||
|
|
|
@ -16,25 +16,19 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.solr;
|
package org.apache.solr;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
//import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
//import org.apache.solr.util.AbstractSolrTestCase;
|
|
||||||
//import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
|
||||||
//import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
|
||||||
//import org.apache.solr.client.solrj.SolrServer;
|
|
||||||
//import org.apache.solr.client.solrj.SolrServerException;
|
|
||||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||||
import org.apache.solr.common.params.SolrParams;
|
import org.apache.solr.common.params.SolrParams;
|
||||||
import org.apache.solr.common.util.NamedList;
|
import org.apache.solr.common.util.NamedList;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Test for Loading core properties from a properties file </p>
|
* <p> Test for Loading core properties from a properties file </p>
|
||||||
|
@ -46,7 +40,8 @@ public class TestSolrCoreProperties extends SolrJettyTestBase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTest() throws Exception {
|
public static void beforeTest() throws Exception {
|
||||||
File homeDir = TestUtil.createTempDir(TestSolrCoreProperties.class.getSimpleName());
|
File homeDir = createTempDir();
|
||||||
|
|
||||||
File collDir = new File(homeDir, "collection1");
|
File collDir = new File(homeDir, "collection1");
|
||||||
File dataDir = new File(collDir, "data");
|
File dataDir = new File(collDir, "data");
|
||||||
File confDir = new File(collDir, "conf");
|
File confDir = new File(collDir, "conf");
|
||||||
|
|
|
@ -26,8 +26,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.impl.client.BasicResponseHandler;
|
import org.apache.http.impl.client.BasicResponseHandler;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
|
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
|
@ -170,8 +168,7 @@ public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
|
||||||
createCmd.setCoreName(ONE_NODE_COLLECTION + "core");
|
createCmd.setCoreName(ONE_NODE_COLLECTION + "core");
|
||||||
createCmd.setCollection(ONE_NODE_COLLECTION);
|
createCmd.setCollection(ONE_NODE_COLLECTION);
|
||||||
createCmd.setNumShards(1);
|
createCmd.setNumShards(1);
|
||||||
createCmd.setDataDir(getDataDir(dataDir.getAbsolutePath() + File.separator
|
createCmd.setDataDir(getDataDir(createTempDir(ONE_NODE_COLLECTION).getAbsolutePath()));
|
||||||
+ ONE_NODE_COLLECTION));
|
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -417,7 +414,7 @@ public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
|
||||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
ModifiableSolrParams params = new ModifiableSolrParams();
|
||||||
params.set("qt", "/replication");
|
params.set("qt", "/replication");
|
||||||
params.set("command", "backup");
|
params.set("command", "backup");
|
||||||
File location = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "-backupdir");
|
File location = createTempDir();
|
||||||
params.set("location", location.getAbsolutePath());
|
params.set("location", location.getAbsolutePath());
|
||||||
|
|
||||||
QueryRequest request = new QueryRequest(params);
|
QueryRequest request = new QueryRequest(params);
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.apache.solr.cloud;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -38,8 +37,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
|
|
||||||
import org.apache.solr.JSONTestUtil;
|
import org.apache.solr.JSONTestUtil;
|
||||||
|
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
import org.apache.solr.client.solrj.SolrRequest;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
|
@ -388,8 +387,7 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
|
||||||
Create createCmd = new Create();
|
Create createCmd = new Create();
|
||||||
createCmd.setCoreName("core1");
|
createCmd.setCoreName("core1");
|
||||||
createCmd.setCollection("the_core_collection");
|
createCmd.setCollection("the_core_collection");
|
||||||
String coredataDir = dataDir.getAbsolutePath() + File.separator
|
String coredataDir = createTempDir().getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + "the_core_collection";
|
|
||||||
createCmd.setDataDir(coredataDir);
|
createCmd.setDataDir(coredataDir);
|
||||||
createCmd.setNumShards(1);
|
createCmd.setNumShards(1);
|
||||||
createCmd.setSchemaName("nonexistent_schema.xml");
|
createCmd.setSchemaName("nonexistent_schema.xml");
|
||||||
|
@ -569,8 +567,7 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
|
||||||
|
|
||||||
createCmd.setNumShards(numShards);
|
createCmd.setNumShards(numShards);
|
||||||
try {
|
try {
|
||||||
String core3dataDir = dataDir.getAbsolutePath() + File.separator
|
String core3dataDir = createTempDir(collection).getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + collection + "_3n" + freezeI;
|
|
||||||
createCmd.setDataDir(getDataDir(core3dataDir));
|
createCmd.setDataDir(getDataDir(core3dataDir));
|
||||||
|
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
|
@ -982,8 +979,7 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
|
||||||
if (shardId == null) {
|
if (shardId == null) {
|
||||||
createCmd.setNumShards(2);
|
createCmd.setNumShards(2);
|
||||||
}
|
}
|
||||||
createCmd.setDataDir(getDataDir(dataDir.getAbsolutePath() + File.separator
|
createCmd.setDataDir(getDataDir(createTempDir(collection).getAbsolutePath()));
|
||||||
+ collection + num));
|
|
||||||
if (shardId != null) {
|
if (shardId != null) {
|
||||||
createCmd.setShardId(shardId);
|
createCmd.setShardId(shardId);
|
||||||
}
|
}
|
||||||
|
@ -1110,11 +1106,8 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
|
||||||
server.setSoTimeout(60000);
|
server.setSoTimeout(60000);
|
||||||
Create createCmd = new Create();
|
Create createCmd = new Create();
|
||||||
createCmd.setCoreName(collection);
|
createCmd.setCoreName(collection);
|
||||||
createCmd.setDataDir(getDataDir(dataDir.getAbsolutePath() + File.separator
|
createCmd.setDataDir(getDataDir(createTempDir(collection).getAbsolutePath()));
|
||||||
+ collection + frozeUnique));
|
|
||||||
|
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
//fails
|
//fails
|
||||||
|
|
|
@ -68,11 +68,12 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private File dataDir4;
|
private File dataDir4;
|
||||||
|
|
||||||
private static File solrHomeDirectory;
|
|
||||||
|
private static volatile File solrHomeDirectory;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws IOException {
|
public static void beforeClass() throws IOException {
|
||||||
solrHomeDirectory = TestUtil.createTempDir(ClusterStateUpdateTest.class.getSimpleName());
|
solrHomeDirectory = new File(createTempDir(), "ZkControllerTest");
|
||||||
System.setProperty("solrcloud.skip.autorecovery", "true");
|
System.setProperty("solrcloud.skip.autorecovery", "true");
|
||||||
System.setProperty("genericCoreNodeNames", "false");
|
System.setProperty("genericCoreNodeNames", "false");
|
||||||
if (solrHomeDirectory.exists()) {
|
if (solrHomeDirectory.exists()) {
|
||||||
|
@ -95,10 +96,9 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
createTempDir();
|
|
||||||
System.setProperty("zkClientTimeout", "3000");
|
System.setProperty("zkClientTimeout", "3000");
|
||||||
|
File tmpDir = createTempDir();
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
zkDir = tmpDir.getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
zkServer.run();
|
zkServer.run();
|
||||||
|
@ -107,16 +107,16 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
.getZkAddress(), "solrconfig.xml", "schema.xml");
|
.getZkAddress(), "solrconfig.xml", "schema.xml");
|
||||||
|
|
||||||
log.info("####SETUP_START " + getTestName());
|
log.info("####SETUP_START " + getTestName());
|
||||||
dataDir1 = new File(dataDir + File.separator + "data1");
|
dataDir1 = new File(tmpDir + File.separator + "data1");
|
||||||
dataDir1.mkdirs();
|
dataDir1.mkdirs();
|
||||||
|
|
||||||
dataDir2 = new File(dataDir + File.separator + "data2");
|
dataDir2 = new File(tmpDir + File.separator + "data2");
|
||||||
dataDir2.mkdirs();
|
dataDir2.mkdirs();
|
||||||
|
|
||||||
dataDir3 = new File(dataDir + File.separator + "data3");
|
dataDir3 = new File(tmpDir + File.separator + "data3");
|
||||||
dataDir3.mkdirs();
|
dataDir3.mkdirs();
|
||||||
|
|
||||||
dataDir4 = new File(dataDir + File.separator + "data4");
|
dataDir4 = new File(tmpDir + File.separator + "data4");
|
||||||
dataDir4.mkdirs();
|
dataDir4.mkdirs();
|
||||||
|
|
||||||
// set some system properties for use by tests
|
// set some system properties for use by tests
|
||||||
|
|
|
@ -50,7 +50,6 @@ import javax.management.ObjectName;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.lucene.util.TestUtil;
|
import org.apache.lucene.util.TestUtil;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
import org.apache.solr.client.solrj.SolrRequest;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
|
@ -335,8 +334,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
|
||||||
Create createCmd = new Create();
|
Create createCmd = new Create();
|
||||||
createCmd.setCoreName("halfdeletedcollection_shard1_replica1");
|
createCmd.setCoreName("halfdeletedcollection_shard1_replica1");
|
||||||
createCmd.setCollection(collectionName);
|
createCmd.setCollection(collectionName);
|
||||||
String dataDir = SolrTestCaseJ4.dataDir.getAbsolutePath() + File.separator
|
String dataDir = createTempDir().getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + "halfcollection" + "_hdn";
|
|
||||||
createCmd.setDataDir(dataDir);
|
createCmd.setDataDir(dataDir);
|
||||||
createCmd.setNumShards(2);
|
createCmd.setNumShards(2);
|
||||||
if (secondConfigSet) {
|
if (secondConfigSet) {
|
||||||
|
@ -527,8 +525,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
|
||||||
Create createCmd = new Create();
|
Create createCmd = new Create();
|
||||||
createCmd.setCoreName("halfcollection_shard1_replica1");
|
createCmd.setCoreName("halfcollection_shard1_replica1");
|
||||||
createCmd.setCollection("halfcollectionblocker");
|
createCmd.setCollection("halfcollectionblocker");
|
||||||
String dataDir = SolrTestCaseJ4.dataDir.getAbsolutePath() + File.separator
|
String dataDir = createTempDir().getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + "halfcollection" + "_3n";
|
|
||||||
createCmd.setDataDir(dataDir);
|
createCmd.setDataDir(dataDir);
|
||||||
createCmd.setNumShards(1);
|
createCmd.setNumShards(1);
|
||||||
if (secondConfigSet) {
|
if (secondConfigSet) {
|
||||||
|
@ -539,8 +536,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
|
||||||
createCmd = new Create();
|
createCmd = new Create();
|
||||||
createCmd.setCoreName("halfcollection_shard1_replica1");
|
createCmd.setCoreName("halfcollection_shard1_replica1");
|
||||||
createCmd.setCollection("halfcollectionblocker2");
|
createCmd.setCollection("halfcollectionblocker2");
|
||||||
dataDir = SolrTestCaseJ4.dataDir.getAbsolutePath() + File.separator
|
dataDir = createTempDir().getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + "halfcollection" + "_3n";
|
|
||||||
createCmd.setDataDir(dataDir);
|
createCmd.setDataDir(dataDir);
|
||||||
createCmd.setNumShards(1);
|
createCmd.setNumShards(1);
|
||||||
if (secondConfigSet) {
|
if (secondConfigSet) {
|
||||||
|
@ -589,8 +585,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
|
||||||
Create createCmd = new Create();
|
Create createCmd = new Create();
|
||||||
createCmd.setCoreName("corewithnocollection");
|
createCmd.setCoreName("corewithnocollection");
|
||||||
createCmd.setCollection("");
|
createCmd.setCollection("");
|
||||||
String dataDir = SolrTestCaseJ4.dataDir.getAbsolutePath() + File.separator
|
String dataDir = createTempDir().getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + "corewithnocollection" + "_1v";
|
|
||||||
createCmd.setDataDir(dataDir);
|
createCmd.setDataDir(dataDir);
|
||||||
createCmd.setNumShards(1);
|
createCmd.setNumShards(1);
|
||||||
if (secondConfigSet) {
|
if (secondConfigSet) {
|
||||||
|
|
|
@ -36,9 +36,8 @@ public class ConnectionManagerTest extends SolrTestCaseJ4 {
|
||||||
@Ignore
|
@Ignore
|
||||||
public void testConnectionManager() throws Exception {
|
public void testConnectionManager() throws Exception {
|
||||||
|
|
||||||
createTempDir();
|
|
||||||
// setup a SolrZkClient to do some getBaseUrlForNodeName testing
|
// setup a SolrZkClient to do some getBaseUrlForNodeName testing
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -72,9 +71,8 @@ public class ConnectionManagerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
public void testLikelyExpired() throws Exception {
|
public void testLikelyExpired() throws Exception {
|
||||||
|
|
||||||
createTempDir();
|
|
||||||
// setup a SolrZkClient to do some getBaseUrlForNodeName testing
|
// setup a SolrZkClient to do some getBaseUrlForNodeName testing
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
|
|
@ -73,14 +73,14 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 {
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
createTempDir();
|
|
||||||
ignoreException("No UpdateLog found - cannot sync");
|
ignoreException("No UpdateLog found - cannot sync");
|
||||||
ignoreException("No UpdateLog found - cannot recover");
|
ignoreException("No UpdateLog found - cannot recover");
|
||||||
|
|
||||||
System.setProperty("zkClientTimeout", "8000");
|
System.setProperty("zkClientTimeout", "8000");
|
||||||
|
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper" + System.currentTimeMillis() + "/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
zkServer.run();
|
zkServer.run();
|
||||||
System.setProperty("zkHost", zkServer.getZkAddress());
|
System.setProperty("zkHost", zkServer.getZkAddress());
|
||||||
|
@ -133,8 +133,7 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private void setupContainer(int port, String shard) throws IOException,
|
private void setupContainer(int port, String shard) throws IOException,
|
||||||
ParserConfigurationException, SAXException {
|
ParserConfigurationException, SAXException {
|
||||||
File data = new File(dataDir + File.separator + "data_" + port);
|
File data = createTempDir();
|
||||||
data.mkdirs();
|
|
||||||
|
|
||||||
System.setProperty("hostPort", Integer.toString(port));
|
System.setProperty("hostPort", Integer.toString(port));
|
||||||
System.setProperty("shard", shard);
|
System.setProperty("shard", shard);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class LeaderElectionTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() {
|
public static void beforeClass() {
|
||||||
createTempDir();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
@ -66,7 +66,7 @@ public class LeaderElectionTest extends SolrTestCaseJ4 {
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
server = new ZkTestServer(zkDir);
|
server = new ZkTestServer(zkDir);
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.apache.solr.common.cloud.Slice;
|
||||||
import org.apache.solr.common.cloud.SolrZkClient;
|
import org.apache.solr.common.cloud.SolrZkClient;
|
||||||
import org.apache.solr.common.cloud.ZkNodeProps;
|
import org.apache.solr.common.cloud.ZkNodeProps;
|
||||||
import org.apache.solr.common.cloud.ZkStateReader;
|
import org.apache.solr.common.cloud.ZkStateReader;
|
||||||
import org.apache.solr.handler.admin.CollectionsHandler;
|
|
||||||
import org.apache.solr.handler.component.HttpShardHandlerFactory;
|
import org.apache.solr.handler.component.HttpShardHandlerFactory;
|
||||||
import org.apache.solr.util.DefaultSolrThreadFactory;
|
import org.apache.solr.util.DefaultSolrThreadFactory;
|
||||||
import org.apache.zookeeper.CreateMode;
|
import org.apache.zookeeper.CreateMode;
|
||||||
|
@ -204,7 +203,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShardAssignment() throws Exception {
|
public void testShardAssignment() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -260,7 +259,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBadQueueItem() throws Exception {
|
public void testBadQueueItem() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -335,7 +334,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShardAssignmentBigger() throws Exception {
|
public void testShardAssignmentBigger() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
final int nodeCount = random().nextInt(50)+50; //how many simulated nodes (num of threads)
|
final int nodeCount = random().nextInt(50)+50; //how many simulated nodes (num of threads)
|
||||||
|
@ -506,7 +505,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStateChange() throws Exception {
|
public void testStateChange() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -603,7 +602,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOverseerFailure() throws Exception {
|
public void testOverseerFailure() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
|
||||||
|
@ -726,7 +725,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShardLeaderChange() throws Exception {
|
public void testShardLeaderChange() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
final ZkTestServer server = new ZkTestServer(zkDir);
|
final ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
SolrZkClient controllerClient = null;
|
SolrZkClient controllerClient = null;
|
||||||
|
@ -782,7 +781,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoubleAssignment() throws Exception {
|
public void testDoubleAssignment() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -847,7 +846,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPlaceholders() throws Exception {
|
public void testPlaceholders() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -896,7 +895,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReplay() throws Exception{
|
public void testReplay() throws Exception{
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
SolrZkClient zkClient = null;
|
SolrZkClient zkClient = null;
|
||||||
|
|
|
@ -74,10 +74,10 @@ public class SliceStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
createTempDir();
|
|
||||||
System.setProperty("zkClientTimeout", "3000");
|
System.setProperty("zkClientTimeout", "3000");
|
||||||
|
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
zkServer.run();
|
zkServer.run();
|
||||||
|
@ -99,11 +99,9 @@ public class SliceStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
CreateMode.PERSISTENT, true);
|
CreateMode.PERSISTENT, true);
|
||||||
zkClient.close();
|
zkClient.close();
|
||||||
|
|
||||||
dataDir1 = new File(dataDir + File.separator + "data1");
|
dataDir1 = new File(createTempDir() + File.separator + "data1");
|
||||||
dataDir1.mkdirs();
|
|
||||||
|
|
||||||
dataDir2 = new File(dataDir + File.separator + "data2");
|
dataDir2 = new File(createTempDir() + File.separator + "data2");
|
||||||
dataDir2.mkdirs();
|
|
||||||
|
|
||||||
// set some system properties for use by tests
|
// set some system properties for use by tests
|
||||||
System.setProperty("solr.test.sys.prop1", "propone");
|
System.setProperty("solr.test.sys.prop1", "propone");
|
||||||
|
|
|
@ -16,8 +16,10 @@ package org.apache.solr.cloud;
|
||||||
* the License.
|
* the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
import java.io.File;
|
||||||
import com.google.common.base.Charsets;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
|
@ -32,11 +34,8 @@ import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
import org.junit.rules.TestRule;
|
import org.junit.rules.TestRule;
|
||||||
|
|
||||||
import java.io.File;
|
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
||||||
import java.io.IOException;
|
import com.google.common.base.Charsets;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
|
|
||||||
public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
|
@ -51,8 +50,6 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private ZkStateReader reader;
|
private ZkStateReader reader;
|
||||||
|
|
||||||
private static int PORT = 7000;
|
|
||||||
|
|
||||||
private ConfigSolr cfg;
|
private ConfigSolr cfg;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -61,9 +58,9 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpZkAndDiskXml(boolean toZk, boolean leaveOnLocal) throws Exception {
|
private void setUpZkAndDiskXml(boolean toZk, boolean leaveOnLocal) throws Exception {
|
||||||
|
File tmpDir = createTempDir();
|
||||||
createTempDir();
|
recurseDelete(tmpDir);
|
||||||
File solrHome = new File(dataDir, "home");
|
File solrHome = new File(tmpDir, "home");
|
||||||
copyMinConf(new File(solrHome, "myCollect"));
|
copyMinConf(new File(solrHome, "myCollect"));
|
||||||
if (leaveOnLocal) {
|
if (leaveOnLocal) {
|
||||||
FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr-stress-new.xml"), new File(solrHome, "solr.xml"));
|
FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr-stress-new.xml"), new File(solrHome, "solr.xml"));
|
||||||
|
@ -76,7 +73,7 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
System.setProperty("zkClientTimeout", "8000");
|
System.setProperty("zkClientTimeout", "8000");
|
||||||
|
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
zkDir = tmpDir.getAbsolutePath() + File.separator
|
||||||
+ "zookeeper" + System.currentTimeMillis() + "/server1/data";
|
+ "zookeeper" + System.currentTimeMillis() + "/server1/data";
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
zkServer.run();
|
zkServer.run();
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.solr.cloud;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.cloud.SolrZkClient;
|
import org.apache.solr.common.cloud.SolrZkClient;
|
||||||
import org.apache.solr.core.CoreContainer;
|
import org.apache.solr.core.CoreContainer;
|
||||||
|
@ -36,6 +34,7 @@ public class TestMultiCoreConfBootstrap extends SolrTestCaseJ4 {
|
||||||
protected CoreContainer cores = null;
|
protected CoreContainer cores = null;
|
||||||
private String home;
|
private String home;
|
||||||
|
|
||||||
|
protected File dataDir1;
|
||||||
protected File dataDir2;
|
protected File dataDir2;
|
||||||
protected ZkTestServer zkServer;
|
protected ZkTestServer zkServer;
|
||||||
protected String zkDir;
|
protected String zkDir;
|
||||||
|
@ -44,16 +43,15 @@ public class TestMultiCoreConfBootstrap extends SolrTestCaseJ4 {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
dataDir1 = createTempDir();
|
||||||
createTempDir();
|
dataDir2 = createTempDir();
|
||||||
dataDir2 = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
|
|
||||||
home = ExternalPaths.EXAMPLE_MULTICORE_HOME;
|
home = ExternalPaths.EXAMPLE_MULTICORE_HOME;
|
||||||
System.setProperty("solr.solr.home", home);
|
System.setProperty("solr.solr.home", home);
|
||||||
System.setProperty( "solr.core0.data.dir", dataDir.getCanonicalPath() );
|
System.setProperty( "solr.core0.data.dir", dataDir1.getCanonicalPath() );
|
||||||
System.setProperty( "solr.core1.data.dir", dataDir2.getCanonicalPath() );
|
System.setProperty( "solr.core1.data.dir", dataDir2.getCanonicalPath() );
|
||||||
|
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
zkDir = dataDir1.getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
zkServer.run();
|
zkServer.run();
|
||||||
|
|
|
@ -17,11 +17,12 @@ package org.apache.solr.cloud;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.cloud.SolrZkClient;
|
import org.apache.solr.common.cloud.SolrZkClient;
|
||||||
import org.apache.solr.common.cloud.ZooKeeperException;
|
import org.apache.solr.common.cloud.ZooKeeperException;
|
||||||
import org.apache.solr.core.CoreContainer;
|
import org.apache.solr.core.CoreContainer;
|
||||||
import org.apache.solr.util.AbstractSolrTestCase;
|
|
||||||
import org.apache.solr.util.ExternalPaths;
|
import org.apache.solr.util.ExternalPaths;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -29,8 +30,6 @@ import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class TestZkChroot extends SolrTestCaseJ4 {
|
public class TestZkChroot extends SolrTestCaseJ4 {
|
||||||
protected static Logger log = LoggerFactory.getLogger(TestZkChroot.class);
|
protected static Logger log = LoggerFactory.getLogger(TestZkChroot.class);
|
||||||
protected CoreContainer cores = null;
|
protected CoreContainer cores = null;
|
||||||
|
@ -43,8 +42,8 @@ public class TestZkChroot extends SolrTestCaseJ4 {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
createTempDir();
|
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
zkServer.run();
|
zkServer.run();
|
||||||
|
|
|
@ -84,13 +84,11 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
|
||||||
|
|
||||||
private void testUnloadShardAndCollection() throws Exception{
|
private void testUnloadShardAndCollection() throws Exception{
|
||||||
// create one leader and one replica
|
// create one leader and one replica
|
||||||
|
|
||||||
Create createCmd = new Create();
|
Create createCmd = new Create();
|
||||||
createCmd.setCoreName("test_unload_shard_and_collection_1");
|
createCmd.setCoreName("test_unload_shard_and_collection_1");
|
||||||
String collection = "test_unload_shard_and_collection";
|
String collection = "test_unload_shard_and_collection";
|
||||||
createCmd.setCollection(collection);
|
createCmd.setCollection(collection);
|
||||||
String coreDataDir = dataDir.getAbsolutePath() + File.separator
|
String coreDataDir = createTempDir().getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + collection + "1";
|
|
||||||
createCmd.setDataDir(getDataDir(coreDataDir));
|
createCmd.setDataDir(getDataDir(coreDataDir));
|
||||||
createCmd.setNumShards(2);
|
createCmd.setNumShards(2);
|
||||||
|
|
||||||
|
@ -105,8 +103,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
|
||||||
createCmd.setCoreName("test_unload_shard_and_collection_2");
|
createCmd.setCoreName("test_unload_shard_and_collection_2");
|
||||||
collection = "test_unload_shard_and_collection";
|
collection = "test_unload_shard_and_collection";
|
||||||
createCmd.setCollection(collection);
|
createCmd.setCollection(collection);
|
||||||
coreDataDir = dataDir.getAbsolutePath() + File.separator
|
coreDataDir = createTempDir().getAbsolutePath();
|
||||||
+ System.currentTimeMillis() + collection + "2";
|
|
||||||
createCmd.setDataDir(getDataDir(coreDataDir));
|
createCmd.setDataDir(getDataDir(coreDataDir));
|
||||||
|
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
|
@ -157,6 +154,8 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
|
||||||
* @throws Exception on any problem
|
* @throws Exception on any problem
|
||||||
*/
|
*/
|
||||||
private void testCoreUnloadAndLeaders() throws Exception {
|
private void testCoreUnloadAndLeaders() throws Exception {
|
||||||
|
File tmpDir = createTempDir();
|
||||||
|
|
||||||
// create a new collection collection
|
// create a new collection collection
|
||||||
SolrServer client = clients.get(0);
|
SolrServer client = clients.get(0);
|
||||||
String url1 = getBaseUrl(client);
|
String url1 = getBaseUrl(client);
|
||||||
|
@ -168,7 +167,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
|
||||||
createCmd.setCoreName("unloadcollection1");
|
createCmd.setCoreName("unloadcollection1");
|
||||||
createCmd.setCollection("unloadcollection");
|
createCmd.setCollection("unloadcollection");
|
||||||
createCmd.setNumShards(1);
|
createCmd.setNumShards(1);
|
||||||
String core1DataDir = dataDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection1" + "_1n";
|
String core1DataDir = tmpDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection1" + "_1n";
|
||||||
createCmd.setDataDir(getDataDir(core1DataDir));
|
createCmd.setDataDir(getDataDir(core1DataDir));
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
|
@ -188,7 +187,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
|
||||||
createCmd = new Create();
|
createCmd = new Create();
|
||||||
createCmd.setCoreName("unloadcollection2");
|
createCmd.setCoreName("unloadcollection2");
|
||||||
createCmd.setCollection("unloadcollection");
|
createCmd.setCollection("unloadcollection");
|
||||||
String core2dataDir = dataDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection1" + "_2n";
|
String core2dataDir = tmpDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection1" + "_2n";
|
||||||
createCmd.setDataDir(getDataDir(core2dataDir));
|
createCmd.setDataDir(getDataDir(core2dataDir));
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
|
@ -230,7 +229,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
|
||||||
createCmd = new Create();
|
createCmd = new Create();
|
||||||
createCmd.setCoreName("unloadcollection3");
|
createCmd.setCoreName("unloadcollection3");
|
||||||
createCmd.setCollection("unloadcollection");
|
createCmd.setCollection("unloadcollection");
|
||||||
String core3dataDir = dataDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection" + "_3n";
|
String core3dataDir = tmpDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection" + "_3n";
|
||||||
createCmd.setDataDir(getDataDir(core3dataDir));
|
createCmd.setDataDir(getDataDir(core3dataDir));
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
|
@ -308,7 +307,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
|
||||||
createCmd = new Create();
|
createCmd = new Create();
|
||||||
createCmd.setCoreName("unloadcollection4");
|
createCmd.setCoreName("unloadcollection4");
|
||||||
createCmd.setCollection("unloadcollection");
|
createCmd.setCollection("unloadcollection");
|
||||||
String core4dataDir = dataDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection" + "_4n";
|
String core4dataDir = tmpDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + "unloadcollection" + "_4n";
|
||||||
createCmd.setDataDir(getDataDir(core4dataDir));
|
createCmd.setDataDir(getDataDir(core4dataDir));
|
||||||
server.request(createCmd);
|
server.request(createCmd);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
|
|
|
@ -28,8 +28,6 @@ import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.io.filefilter.RegexFileFilter;
|
import org.apache.commons.io.filefilter.RegexFileFilter;
|
||||||
import org.apache.commons.io.filefilter.TrueFileFilter;
|
import org.apache.commons.io.filefilter.TrueFileFilter;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.cloud.SolrZkClient;
|
import org.apache.solr.common.cloud.SolrZkClient;
|
||||||
|
@ -76,21 +74,20 @@ public class ZkCLITest extends SolrTestCaseJ4 {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
log.info("####SETUP_START " + getTestName());
|
log.info("####SETUP_START " + getTestName());
|
||||||
createTempDir();
|
|
||||||
|
|
||||||
boolean useNewSolrXml = random().nextBoolean();
|
boolean useNewSolrXml = random().nextBoolean();
|
||||||
|
File tmpDir = createTempDir();
|
||||||
if (useNewSolrXml) {
|
if (useNewSolrXml) {
|
||||||
solrHome = ExternalPaths.EXAMPLE_HOME;
|
solrHome = ExternalPaths.EXAMPLE_HOME;
|
||||||
} else {
|
} else {
|
||||||
File tmpSolrHome = new File(dataDir, "tmp-solr-home");
|
File tmpSolrHome = new File(tmpDir, "tmp-solr-home");
|
||||||
FileUtils.copyDirectory(new File(ExternalPaths.EXAMPLE_HOME), tmpSolrHome);
|
FileUtils.copyDirectory(new File(ExternalPaths.EXAMPLE_HOME), tmpSolrHome);
|
||||||
FileUtils.copyFile(getFile("old-solr-example/solr.xml"), new File(tmpSolrHome, "solr.xml"));
|
FileUtils.copyFile(getFile("old-solr-example/solr.xml"), new File(tmpSolrHome, "solr.xml"));
|
||||||
solrHome = tmpSolrHome.getAbsolutePath();
|
solrHome = tmpSolrHome.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
zkDir = dataDir.getAbsolutePath() + File.separator
|
zkDir = tmpDir.getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
log.info("ZooKeeper dataDir:" + zkDir);
|
log.info("ZooKeeper dataDir:" + zkDir);
|
||||||
zkServer = new ZkTestServer(zkDir);
|
zkServer = new ZkTestServer(zkDir);
|
||||||
|
@ -206,6 +203,8 @@ public class ZkCLITest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpConfigLinkConfigClearZk() throws Exception {
|
public void testUpConfigLinkConfigClearZk() throws Exception {
|
||||||
|
File tmpDir = createTempDir();
|
||||||
|
|
||||||
// test upconfig
|
// test upconfig
|
||||||
String confsetname = "confsetone";
|
String confsetname = "confsetone";
|
||||||
String[] args = new String[] {
|
String[] args = new String[] {
|
||||||
|
@ -233,7 +232,8 @@ public class ZkCLITest extends SolrTestCaseJ4 {
|
||||||
assertEquals(confsetname, collectionProps.getStr("configName"));
|
assertEquals(confsetname, collectionProps.getStr("configName"));
|
||||||
|
|
||||||
// test down config
|
// test down config
|
||||||
File confDir = new File(TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()), "solrtest-confdropspot");
|
File confDir = new File(tmpDir,
|
||||||
|
"solrtest-confdropspot-" + this.getClass().getName() + "-" + System.currentTimeMillis());
|
||||||
assertFalse(confDir.exists());
|
assertFalse(confDir.exists());
|
||||||
|
|
||||||
args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd",
|
args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd",
|
||||||
|
@ -277,11 +277,14 @@ public class ZkCLITest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFile() throws Exception {
|
public void testGetFile() throws Exception {
|
||||||
|
File tmpDir = createTempDir();
|
||||||
|
|
||||||
String getNode = "/getFileNode";
|
String getNode = "/getFileNode";
|
||||||
byte [] data = new String("getFileNode-data").getBytes("UTF-8");
|
byte [] data = new String("getFileNode-data").getBytes("UTF-8");
|
||||||
this.zkClient.create(getNode, data, CreateMode.PERSISTENT, true);
|
this.zkClient.create(getNode, data, CreateMode.PERSISTENT, true);
|
||||||
|
|
||||||
File file = TestUtil.createTempFile("solrtest-getfile", "");
|
File file = new File(tmpDir,
|
||||||
|
"solrtest-getfile-" + this.getClass().getName() + "-" + System.currentTimeMillis());
|
||||||
String[] args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd",
|
String[] args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd",
|
||||||
"getfile", getNode, file.getAbsolutePath()};
|
"getfile", getNode, file.getAbsolutePath()};
|
||||||
ZkCLI.main(args);
|
ZkCLI.main(args);
|
||||||
|
@ -292,9 +295,10 @@ public class ZkCLITest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFileNotExists() throws Exception {
|
public void testGetFileNotExists() throws Exception {
|
||||||
|
File tmpDir = createTempDir();
|
||||||
String getNode = "/getFileNotExistsNode";
|
String getNode = "/getFileNotExistsNode";
|
||||||
|
|
||||||
File file = TestUtil.createTempFile("solrtest-getfilenotexists", "");
|
File file = File.createTempFile("newfile", null, tmpDir);
|
||||||
String[] args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd",
|
String[] args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd",
|
||||||
"getfile", getNode, file.getAbsolutePath()};
|
"getfile", getNode, file.getAbsolutePath()};
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
createTempDir();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
@ -81,7 +81,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
|
||||||
ZkController.generateNodeName("foo-bar", "77", "/solr/sub_dir/"));
|
ZkController.generateNodeName("foo-bar", "77", "/solr/sub_dir/"));
|
||||||
|
|
||||||
// setup a SolrZkClient to do some getBaseUrlForNodeName testing
|
// setup a SolrZkClient to do some getBaseUrlForNodeName testing
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -152,7 +152,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadConfigName() throws Exception {
|
public void testReadConfigName() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
CoreContainer cc = null;
|
CoreContainer cc = null;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploadToCloud() throws Exception {
|
public void testUploadToCloud() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
ZkTestServer server = new ZkTestServer(zkDir);
|
ZkTestServer server = new ZkTestServer(zkDir);
|
||||||
|
@ -261,7 +261,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHostName() throws Exception {
|
public void testGetHostName() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
CoreContainer cc = null;
|
CoreContainer cc = null;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ZkSolrClientTest extends AbstractSolrTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConnect() throws Exception {
|
public void testConnect() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
ZkTestServer server = null;
|
ZkTestServer server = null;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class ZkSolrClientTest extends AbstractSolrTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMakeRootNode() throws Exception {
|
public void testMakeRootNode() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
ZkTestServer server = null;
|
ZkTestServer server = null;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class ZkSolrClientTest extends AbstractSolrTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testClean() throws Exception {
|
public void testClean() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
ZkTestServer server = null;
|
ZkTestServer server = null;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class ZkSolrClientTest extends AbstractSolrTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReconnect() throws Exception {
|
public void testReconnect() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
ZkTestServer server = null;
|
ZkTestServer server = null;
|
||||||
SolrZkClient zkClient = null;
|
SolrZkClient zkClient = null;
|
||||||
|
@ -193,7 +193,7 @@ public class ZkSolrClientTest extends AbstractSolrTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWatchChildren() throws Exception {
|
public void testWatchChildren() throws Exception {
|
||||||
String zkDir = dataDir.getAbsolutePath() + File.separator
|
String zkDir = createTempDir().getAbsolutePath() + File.separator
|
||||||
+ "zookeeper/server1/data";
|
+ "zookeeper/server1/data";
|
||||||
|
|
||||||
final AtomicInteger cnt = new AtomicInteger();
|
final AtomicInteger cnt = new AtomicInteger();
|
||||||
|
|
|
@ -21,7 +21,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.cloud.BasicDistributedZk2Test;
|
import org.apache.solr.cloud.BasicDistributedZk2Test;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -38,7 +37,7 @@ public class HdfsBasicDistributedZk2Test extends BasicDistributedZk2Test {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class HdfsBasicDistributedZkTest extends BasicDistributedZkTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -21,7 +21,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.cloud.ChaosMonkeySafeLeaderTest;
|
import org.apache.solr.cloud.ChaosMonkeySafeLeaderTest;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -39,7 +38,7 @@ public class HdfsChaosMonkeySafeLeaderTest extends ChaosMonkeySafeLeaderTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -17,11 +17,9 @@ package org.apache.solr.cloud.hdfs;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.cloud.CollectionsAPIDistributedZkTest;
|
import org.apache.solr.cloud.CollectionsAPIDistributedZkTest;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -39,7 +37,7 @@ public class HdfsCollectionsAPIDistributedZkTest extends CollectionsAPIDistribut
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
|
|
||||||
System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
|
System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
|
||||||
System.setProperty("solr.hdfs.blockcache.enabled", "false");
|
System.setProperty("solr.hdfs.blockcache.enabled", "false");
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.apache.solr.cloud.hdfs;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
|
@ -38,7 +37,7 @@ public class HdfsRecoveryZkTest extends RecoveryZkTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
System.setProperty("solr.hdfs.blockcache.blocksperbank", "2048");
|
System.setProperty("solr.hdfs.blockcache.blocksperbank", "2048");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,7 @@ package org.apache.solr.cloud.hdfs;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
|
@ -40,7 +38,7 @@ public class HdfsSyncSliceTest extends SyncSliceTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -39,12 +39,10 @@ public class HdfsTestUtil {
|
||||||
|
|
||||||
private static Map<MiniDFSCluster,Timer> timers = new ConcurrentHashMap<>();
|
private static Map<MiniDFSCluster,Timer> timers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static MiniDFSCluster setupClass() throws Exception {
|
public static MiniDFSCluster setupClass(String dir) throws Exception {
|
||||||
LuceneTestCase.assumeFalse("HDFS tests were disabled by -Dtests.disableHdfs",
|
LuceneTestCase.assumeFalse("HDFS tests were disabled by -Dtests.disableHdfs",
|
||||||
Boolean.parseBoolean(System.getProperty("tests.disableHdfs", "false")));
|
Boolean.parseBoolean(System.getProperty("tests.disableHdfs", "false")));
|
||||||
|
|
||||||
File dir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
|
|
||||||
savedLocale = Locale.getDefault();
|
savedLocale = Locale.getDefault();
|
||||||
// TODO: we HACK around HADOOP-9643
|
// TODO: we HACK around HADOOP-9643
|
||||||
Locale.setDefault(Locale.ENGLISH);
|
Locale.setDefault(Locale.ENGLISH);
|
||||||
|
@ -55,12 +53,12 @@ public class HdfsTestUtil {
|
||||||
conf.set("dfs.block.access.token.enable", "false");
|
conf.set("dfs.block.access.token.enable", "false");
|
||||||
conf.set("dfs.permissions.enabled", "false");
|
conf.set("dfs.permissions.enabled", "false");
|
||||||
conf.set("hadoop.security.authentication", "simple");
|
conf.set("hadoop.security.authentication", "simple");
|
||||||
conf.set("hdfs.minidfs.basedir", dir.getAbsolutePath() + File.separator + "hdfsBaseDir");
|
conf.set("hdfs.minidfs.basedir", dir + File.separator + "hdfsBaseDir");
|
||||||
conf.set("dfs.namenode.name.dir", dir.getAbsolutePath() + File.separator + "nameNodeNameDir");
|
conf.set("dfs.namenode.name.dir", dir + File.separator + "nameNodeNameDir");
|
||||||
|
|
||||||
|
|
||||||
System.setProperty("test.build.data", dir.getAbsolutePath() + File.separator + "hdfs" + File.separator + "build");
|
System.setProperty("test.build.data", dir + File.separator + "hdfs" + File.separator + "build");
|
||||||
System.setProperty("test.cache.data", dir.getAbsolutePath() + File.separator + "hdfs" + File.separator + "cache");
|
System.setProperty("test.cache.data", dir + File.separator + "hdfs" + File.separator + "cache");
|
||||||
System.setProperty("solr.lock.type", "hdfs");
|
System.setProperty("solr.lock.type", "hdfs");
|
||||||
|
|
||||||
System.setProperty("solr.hdfs.home", "/solr_hdfs_home");
|
System.setProperty("solr.hdfs.home", "/solr_hdfs_home");
|
||||||
|
|
|
@ -17,12 +17,9 @@ package org.apache.solr.cloud.hdfs;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.cloud.UnloadDistributedZkTest;
|
import org.apache.solr.cloud.UnloadDistributedZkTest;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -40,7 +37,7 @@ public class HdfsUnloadDistributedZkTest extends UnloadDistributedZkTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package org.apache.solr.cloud.hdfs;
|
package org.apache.solr.cloud.hdfs;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -26,8 +25,6 @@ import java.util.List;
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.store.NRTCachingDirectory;
|
import org.apache.lucene.store.NRTCachingDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.Nightly;
|
import org.apache.lucene.util.LuceneTestCase.Nightly;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
|
@ -62,7 +59,7 @@ public class HdfsWriteToMultipleCollectionsTest extends BasicDistributedZkTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
schemaString = "schema15.xml"; // we need a string id
|
schemaString = "schema15.xml"; // we need a string id
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
System.setProperty(SOLR_HDFS_HOME, dfsCluster.getURI().toString() + "/solr");
|
System.setProperty(SOLR_HDFS_HOME, dfsCluster.getURI().toString() + "/solr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package org.apache.solr.cloud.hdfs;
|
package org.apache.solr.cloud.hdfs;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
@ -32,7 +31,6 @@ import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
|
import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
|
@ -63,7 +61,7 @@ public class StressHdfsTest extends BasicDistributedZkTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
|
System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -37,9 +35,7 @@ public class CoreContainerCoreInitFailuresTest extends SolrTestCaseJ4 {
|
||||||
CoreContainer cc = null;
|
CoreContainer cc = null;
|
||||||
|
|
||||||
private void init(final String dirSuffix) {
|
private void init(final String dirSuffix) {
|
||||||
// would be nice to do this in an @Before method,
|
solrHome = createTempDir(dirSuffix);
|
||||||
// but junit doesn't let @Before methods have test names
|
|
||||||
solrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + dirSuffix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
|
@ -30,8 +30,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
|
@ -87,7 +85,9 @@ public class OpenCloseCoreStressTest extends SolrTestCaseJ4 {
|
||||||
coreNames = new ArrayList<>();
|
coreNames = new ArrayList<>();
|
||||||
cumulativeDocs = 0;
|
cumulativeDocs = 0;
|
||||||
|
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
solrHomeDirectory = createTempDir();
|
||||||
|
FileUtils.deleteDirectory(solrHomeDirectory); // Ensure that a failed test didn't leave something lying around.
|
||||||
|
|
||||||
jetty = new JettySolrRunner(solrHomeDirectory.getAbsolutePath(), "/solr", 0, null, null, true, null, sslConfig);
|
jetty = new JettySolrRunner(solrHomeDirectory.getAbsolutePath(), "/solr", 0, null, null, true, null, sslConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,20 +17,19 @@ package org.apache.solr.core;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.LockObtainFailedException;
|
import org.apache.lucene.store.LockObtainFailedException;
|
||||||
import org.apache.lucene.store.NativeFSLockFactory;
|
import org.apache.lucene.store.NativeFSLockFactory;
|
||||||
import org.apache.lucene.store.SimpleFSLockFactory;
|
import org.apache.lucene.store.SimpleFSLockFactory;
|
||||||
import org.apache.lucene.util.Version;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {
|
public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,11 +39,8 @@ public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
System.setProperty("solr.directoryFactory", "org.apache.solr.core.SimpleFSDirectoryFactory");
|
System.setProperty("solr.directoryFactory", "org.apache.solr.core.SimpleFSDirectoryFactory");
|
||||||
|
|
||||||
//explicitly creates the temp dataDir so we know where the index will be located
|
|
||||||
createTempDir();
|
|
||||||
|
|
||||||
IndexWriterConfig indexWriterConfig = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
|
IndexWriterConfig indexWriterConfig = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
|
||||||
Directory directory = newFSDirectory(new File(dataDir, "index"));
|
Directory directory = newFSDirectory(new File(createTempDir(), "index"));
|
||||||
//creates a new index on the known location
|
//creates a new index on the known location
|
||||||
new IndexWriter(
|
new IndexWriter(
|
||||||
directory,
|
directory,
|
||||||
|
@ -56,7 +52,7 @@ public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleLockErrorOnStartup() throws Exception {
|
public void testSimpleLockErrorOnStartup() throws Exception {
|
||||||
|
|
||||||
Directory directory = newFSDirectory(new File(dataDir, "index"), new SimpleFSLockFactory());
|
Directory directory = newFSDirectory(new File(initCoreDataDir, "index"), new SimpleFSLockFactory());
|
||||||
//creates a new IndexWriter without releasing the lock yet
|
//creates a new IndexWriter without releasing the lock yet
|
||||||
IndexWriter indexWriter = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, null));
|
IndexWriter indexWriter = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, null));
|
||||||
|
|
||||||
|
@ -80,7 +76,7 @@ public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {
|
||||||
@Test
|
@Test
|
||||||
public void testNativeLockErrorOnStartup() throws Exception {
|
public void testNativeLockErrorOnStartup() throws Exception {
|
||||||
|
|
||||||
File indexDir = new File(dataDir, "index");
|
File indexDir = new File(initCoreDataDir, "index");
|
||||||
log.info("Acquiring lock on {}", indexDir.getAbsolutePath());
|
log.info("Acquiring lock on {}", indexDir.getAbsolutePath());
|
||||||
Directory directory = newFSDirectory(indexDir, new NativeFSLockFactory());
|
Directory directory = newFSDirectory(indexDir, new NativeFSLockFactory());
|
||||||
//creates a new IndexWriter without releasing the lock yet
|
//creates a new IndexWriter without releasing the lock yet
|
||||||
|
|
|
@ -17,19 +17,6 @@
|
||||||
|
|
||||||
package org.apache.solr.core;
|
package org.apache.solr.core;
|
||||||
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
|
||||||
import org.apache.solr.handler.RequestHandlerBase;
|
|
||||||
import org.apache.solr.handler.component.SpellCheckComponent;
|
|
||||||
import org.apache.solr.handler.component.QueryComponent;
|
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
|
||||||
import org.apache.solr.request.SolrRequestHandler;
|
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
|
||||||
import org.apache.solr.schema.IndexSchema;
|
|
||||||
import org.apache.solr.util.DefaultSolrThreadFactory;
|
|
||||||
import org.apache.solr.util.plugin.SolrCoreAware;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -39,6 +26,18 @@ import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
|
import org.apache.solr.handler.RequestHandlerBase;
|
||||||
|
import org.apache.solr.handler.component.QueryComponent;
|
||||||
|
import org.apache.solr.handler.component.SpellCheckComponent;
|
||||||
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
|
import org.apache.solr.request.SolrRequestHandler;
|
||||||
|
import org.apache.solr.response.SolrQueryResponse;
|
||||||
|
import org.apache.solr.schema.IndexSchema;
|
||||||
|
import org.apache.solr.util.DefaultSolrThreadFactory;
|
||||||
|
import org.apache.solr.util.plugin.SolrCoreAware;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
public class SolrCoreTest extends SolrTestCaseJ4 {
|
public class SolrCoreTest extends SolrTestCaseJ4 {
|
||||||
private static final String COLLECTION1 = "collection1";
|
private static final String COLLECTION1 = "collection1";
|
||||||
|
|
||||||
|
@ -67,8 +66,7 @@ public class SolrCoreTest extends SolrTestCaseJ4 {
|
||||||
core.close();
|
core.close();
|
||||||
|
|
||||||
|
|
||||||
SolrCore newCore = new SolrCore(COLLECTION1, dataDir + File.separator
|
SolrCore newCore = new SolrCore(COLLECTION1, createTempDir("dataDir2").getAbsolutePath(), new SolrConfig("solr/collection1", "solrconfig.xml", null), schema,
|
||||||
+ "datadir2", new SolrConfig("solr/collection1", "solrconfig.xml", null), schema,
|
|
||||||
new CoreDescriptor(cores, COLLECTION1, "solr/collection1"));
|
new CoreDescriptor(cores, COLLECTION1, "solr/collection1"));
|
||||||
|
|
||||||
cores.register(newCore, false);
|
cores.register(newCore, false);
|
||||||
|
|
|
@ -73,10 +73,11 @@ public class TestArbitraryIndexDir extends AbstractSolrTestCase{
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
|
File tmpDataDir = createTempDir();
|
||||||
|
|
||||||
dataDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
solrConfig = TestHarness.createConfig(getSolrHome(), "solrconfig.xml");
|
solrConfig = TestHarness.createConfig(getSolrHome(), "solrconfig.xml");
|
||||||
h = new TestHarness( dataDir.getAbsolutePath(),
|
h = new TestHarness( tmpDataDir.getAbsolutePath(),
|
||||||
solrConfig,
|
solrConfig,
|
||||||
"schema12.xml");
|
"schema12.xml");
|
||||||
lrf = h.getRequestFactory
|
lrf = h.getRequestFactory
|
||||||
|
|
|
@ -26,8 +26,6 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -44,7 +42,9 @@ public class TestConfigSets extends SolrTestCaseJ4 {
|
||||||
public static String solrxml = "<solr><str name=\"configSetBaseDir\">${configsets:configsets}</str></solr>";
|
public static String solrxml = "<solr><str name=\"configSetBaseDir\">${configsets:configsets}</str></solr>";
|
||||||
|
|
||||||
public CoreContainer setupContainer(String testName, String configSetsBaseDir) {
|
public CoreContainer setupContainer(String testName, String configSetsBaseDir) {
|
||||||
File testDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "-" + testName);
|
File testDirectory = new File(createTempDir(), testName);
|
||||||
|
testDirectory.mkdirs();
|
||||||
|
|
||||||
System.setProperty("configsets", configSetsBaseDir);
|
System.setProperty("configsets", configSetsBaseDir);
|
||||||
|
|
||||||
SolrResourceLoader loader = new SolrResourceLoader(testDirectory.getAbsolutePath());
|
SolrResourceLoader loader = new SolrResourceLoader(testDirectory.getAbsolutePath());
|
||||||
|
@ -95,7 +95,8 @@ public class TestConfigSets extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConfigSetOnCoreReload() throws IOException {
|
public void testConfigSetOnCoreReload() throws IOException {
|
||||||
File testDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "-core-reload");
|
File testDirectory = new File(initCoreDataDir, "core-reload");
|
||||||
|
testDirectory.mkdirs();
|
||||||
File configSetsDir = new File(testDirectory, "configsets");
|
File configSetsDir = new File(testDirectory, "configsets");
|
||||||
|
|
||||||
FileUtils.copyDirectory(getFile("solr/configsets"), configSetsDir);
|
FileUtils.copyDirectory(getFile("solr/configsets"), configSetsDir);
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class TestCoreContainer extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private CoreContainer init(String dirName) throws Exception {
|
private CoreContainer init(String dirName) throws Exception {
|
||||||
|
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + dirName);
|
solrHomeDirectory = createTempDir(dirName);
|
||||||
|
|
||||||
FileUtils.copyDirectory(new File(SolrTestCaseJ4.TEST_HOME()), solrHomeDirectory);
|
FileUtils.copyDirectory(new File(SolrTestCaseJ4.TEST_HOME()), solrHomeDirectory);
|
||||||
System.out.println("Using solrconfig from " + new File(SolrTestCaseJ4.TEST_HOME()).getAbsolutePath());
|
System.out.println("Using solrconfig from " + new File(SolrTestCaseJ4.TEST_HOME()).getAbsolutePath());
|
||||||
|
@ -148,7 +148,7 @@ public class TestCoreContainer extends SolrTestCaseJ4 {
|
||||||
@Test
|
@Test
|
||||||
public void testNoCores() throws IOException, ParserConfigurationException, SAXException {
|
public void testNoCores() throws IOException, ParserConfigurationException, SAXException {
|
||||||
//create solrHome
|
//create solrHome
|
||||||
File solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "_noCores");
|
File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
boolean oldSolrXml = random().nextBoolean();
|
boolean oldSolrXml = random().nextBoolean();
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -40,10 +38,9 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
|
||||||
initCore();
|
initCore();
|
||||||
}
|
}
|
||||||
|
|
||||||
private File solrHomeDirectory;
|
private final File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
private void setMeUp(String alternateCoreDir) throws Exception {
|
private void setMeUp(String alternateCoreDir) throws Exception {
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
System.setProperty("solr.solr.home", solrHomeDirectory.getAbsolutePath());
|
System.setProperty("solr.solr.home", solrHomeDirectory.getAbsolutePath());
|
||||||
String xmlStr = SOLR_XML;
|
String xmlStr = SOLR_XML;
|
||||||
if (alternateCoreDir != null) {
|
if (alternateCoreDir != null) {
|
||||||
|
@ -196,7 +193,9 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAlternateCoreDir() throws Exception {
|
public void testAlternateCoreDir() throws Exception {
|
||||||
File alt = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
|
File alt = createTempDir();
|
||||||
|
|
||||||
setMeUp(alt.getAbsolutePath());
|
setMeUp(alt.getAbsolutePath());
|
||||||
addCoreWithProps(makeCorePropFile("core1", false, true, "dataDir=core1"),
|
addCoreWithProps(makeCorePropFile("core1", false, true, "dataDir=core1"),
|
||||||
new File(alt, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
|
new File(alt, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
|
||||||
|
@ -214,7 +213,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testNoCoreDir() throws Exception {
|
public void testNoCoreDir() throws Exception {
|
||||||
File noCoreDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File noCoreDir = new File(createTempDir(), "noCoreDir");
|
||||||
setMeUp(noCoreDir.getAbsolutePath());
|
setMeUp(noCoreDir.getAbsolutePath());
|
||||||
addCoreWithProps(makeCorePropFile("core1", false, true),
|
addCoreWithProps(makeCorePropFile("core1", false, true),
|
||||||
new File(noCoreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
|
new File(noCoreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
|
||||||
|
|
|
@ -29,8 +29,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.codec.Charsets;
|
import org.apache.commons.codec.Charsets;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.params.CoreAdminParams;
|
import org.apache.solr.common.params.CoreAdminParams;
|
||||||
|
@ -43,7 +41,7 @@ import org.apache.solr.update.AddUpdateCommand;
|
||||||
import org.apache.solr.update.CommitUpdateCommand;
|
import org.apache.solr.update.CommitUpdateCommand;
|
||||||
import org.apache.solr.update.UpdateHandler;
|
import org.apache.solr.update.UpdateHandler;
|
||||||
import org.apache.solr.util.TestHarness;
|
import org.apache.solr.util.TestHarness;
|
||||||
import org.junit.After;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -55,9 +53,16 @@ public class TestLazyCores extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
private File solrHomeDirectory;
|
private File solrHomeDirectory;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
@Override
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
}
|
||||||
|
|
||||||
private CoreContainer init() throws Exception {
|
private CoreContainer init() throws Exception {
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
for (int idx = 1; idx < 10; ++idx) {
|
for (int idx = 1; idx < 10; ++idx) {
|
||||||
copyMinConf(new File(solrHomeDirectory, "collection" + idx));
|
copyMinConf(new File(solrHomeDirectory, "collection" + idx));
|
||||||
}
|
}
|
||||||
|
@ -75,13 +80,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
|
||||||
cores.load();
|
cores.load();
|
||||||
return cores;
|
return cores;
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
|
||||||
public void after() throws Exception {
|
|
||||||
if (solrHomeDirectory.exists()) {
|
|
||||||
FileUtils.deleteDirectory(solrHomeDirectory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Test
|
@Test
|
||||||
public void testLazyLoad() throws Exception {
|
public void testLazyLoad() throws Exception {
|
||||||
CoreContainer cc = init();
|
CoreContainer cc = init();
|
||||||
|
@ -500,13 +499,13 @@ public class TestLazyCores extends SolrTestCaseJ4 {
|
||||||
// Did we get the expected message for each of the cores that failed to load? Make sure we don't run afoul of
|
// Did we get the expected message for each of the cores that failed to load? Make sure we don't run afoul of
|
||||||
// the dreaded slash/backslash difference on Windows and *nix machines.
|
// the dreaded slash/backslash difference on Windows and *nix machines.
|
||||||
testMessage(cc.getCoreInitFailures(),
|
testMessage(cc.getCoreInitFailures(),
|
||||||
"TestLazyCores" + File.separator + "badConfig1" + File.separator + "solrconfig.xml");
|
"badConfig1" + File.separator + "solrconfig.xml");
|
||||||
testMessage(cc.getCoreInitFailures(),
|
testMessage(cc.getCoreInitFailures(),
|
||||||
"TestLazyCores" + File.separator + "badConfig2" + File.separator + "solrconfig.xml");
|
"badConfig2" + File.separator + "solrconfig.xml");
|
||||||
testMessage(cc.getCoreInitFailures(),
|
testMessage(cc.getCoreInitFailures(),
|
||||||
"TestLazyCores" + File.separator + "badSchema1" + File.separator + "schema.xml");
|
"badSchema1" + File.separator + "schema.xml");
|
||||||
testMessage(cc.getCoreInitFailures(),
|
testMessage(cc.getCoreInitFailures(),
|
||||||
"TestLazyCores" + File.separator + "badSchema2" + File.separator + "schema.xml");
|
"badSchema2" + File.separator + "schema.xml");
|
||||||
|
|
||||||
// Status should report that there are failure messages for the bad cores and none for the good cores.
|
// Status should report that there are failure messages for the bad cores and none for the good cores.
|
||||||
checkStatus(cc, true, "core1");
|
checkStatus(cc, true, "core1");
|
||||||
|
@ -589,15 +588,11 @@ public class TestLazyCores extends SolrTestCaseJ4 {
|
||||||
private CoreContainer initGoodAndBad(List<String> goodCores,
|
private CoreContainer initGoodAndBad(List<String> goodCores,
|
||||||
List<String> badSchemaCores,
|
List<String> badSchemaCores,
|
||||||
List<String> badConfigCores) throws Exception {
|
List<String> badConfigCores) throws Exception {
|
||||||
|
solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
// Don't pollute the log with exception traces when they're expected.
|
// Don't pollute the log with exception traces when they're expected.
|
||||||
ignoreException(Pattern.quote("SAXParseException"));
|
ignoreException(Pattern.quote("SAXParseException"));
|
||||||
|
|
||||||
if (solrHomeDirectory.exists()) {
|
|
||||||
FileUtils.deleteDirectory(solrHomeDirectory);
|
|
||||||
}
|
|
||||||
assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
|
|
||||||
|
|
||||||
// Create the cores that should be fine.
|
// Create the cores that should be fine.
|
||||||
for (String coreName : goodCores) {
|
for (String coreName : goodCores) {
|
||||||
File coreRoot = new File(solrHomeDirectory, coreName);
|
File coreRoot = new File(solrHomeDirectory, coreName);
|
||||||
|
|
|
@ -46,10 +46,10 @@ public class TestNRTOpen extends SolrTestCaseJ4 {
|
||||||
// add a doc
|
// add a doc
|
||||||
assertU(adoc("foo", "bar"));
|
assertU(adoc("foo", "bar"));
|
||||||
assertU(commit());
|
assertU(commit());
|
||||||
File myDir = dataDir;
|
File myDir = initCoreDataDir;
|
||||||
deleteCore();
|
deleteCore();
|
||||||
// boot up again over the same index
|
// boot up again over the same index
|
||||||
dataDir = myDir;
|
initCoreDataDir = myDir;
|
||||||
initCore("solrconfig-basic.xml", "schema-minimal.xml");
|
initCore("solrconfig-basic.xml", "schema-minimal.xml");
|
||||||
// startup
|
// startup
|
||||||
assertNRT(1);
|
assertNRT(1);
|
||||||
|
|
|
@ -51,10 +51,10 @@ public class TestNonNRTOpen extends SolrTestCaseJ4 {
|
||||||
// add a doc
|
// add a doc
|
||||||
assertU(adoc("foo", "bar"));
|
assertU(adoc("foo", "bar"));
|
||||||
assertU(commit());
|
assertU(commit());
|
||||||
File myDir = dataDir;
|
File myDir = initCoreDataDir;
|
||||||
deleteCore();
|
deleteCore();
|
||||||
// boot up again over the same index
|
// boot up again over the same index
|
||||||
dataDir = myDir;
|
initCoreDataDir = myDir;
|
||||||
initCore("solrconfig-basic.xml", "schema-minimal.xml");
|
initCore("solrconfig-basic.xml", "schema-minimal.xml");
|
||||||
// startup
|
// startup
|
||||||
assertNotNRT(1);
|
assertNotNRT(1);
|
||||||
|
|
|
@ -17,23 +17,6 @@ package org.apache.solr.core;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.core.SolrXMLSerializer.SolrCoreXMLDef;
|
|
||||||
import org.apache.solr.core.SolrXMLSerializer.SolrXMLDef;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import javax.xml.xpath.XPath;
|
|
||||||
import javax.xml.xpath.XPathConstants;
|
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
|
||||||
import javax.xml.xpath.XPathFactory;
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -46,8 +29,26 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.xpath.XPath;
|
||||||
|
import javax.xml.xpath.XPathConstants;
|
||||||
|
import javax.xml.xpath.XPathExpressionException;
|
||||||
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
|
||||||
public class TestSolrXMLSerializer extends LuceneTestCase {
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.lucene.util.TestUtil;
|
||||||
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
|
import org.apache.solr.core.SolrXMLSerializer.SolrCoreXMLDef;
|
||||||
|
import org.apache.solr.core.SolrXMLSerializer.SolrXMLDef;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
|
||||||
|
public class TestSolrXMLSerializer extends SolrTestCaseJ4 {
|
||||||
private static final XPathFactory xpathFactory = XPathFactory.newInstance();
|
private static final XPathFactory xpathFactory = XPathFactory.newInstance();
|
||||||
private static final String defaultCoreNameKey = "defaultCoreName";
|
private static final String defaultCoreNameKey = "defaultCoreName";
|
||||||
private static final String defaultCoreNameVal = "collection1";
|
private static final String defaultCoreNameVal = "collection1";
|
||||||
|
@ -81,7 +82,7 @@ public class TestSolrXMLSerializer extends LuceneTestCase {
|
||||||
assertResults(((StringWriter) w).getBuffer().toString().getBytes("UTF-8"));
|
assertResults(((StringWriter) w).getBuffer().toString().getBytes("UTF-8"));
|
||||||
|
|
||||||
// again with default file
|
// again with default file
|
||||||
File tmpFile = TestUtil.createTempFile("solr.xml", null);
|
File tmpFile = TestUtil.createTempFile("solr.xml", null, createTempDir());
|
||||||
|
|
||||||
serializer.persistFile(tmpFile, solrXMLDef);
|
serializer.persistFile(tmpFile, solrXMLDef);
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
|
@ -37,12 +34,7 @@ public class TestSolrXml extends SolrTestCaseJ4 {
|
||||||
@Rule
|
@Rule
|
||||||
public TestRule solrTestRules = RuleChain.outerRule(new SystemPropertiesRestoreRule());
|
public TestRule solrTestRules = RuleChain.outerRule(new SystemPropertiesRestoreRule());
|
||||||
|
|
||||||
private File solrHome;
|
private final File solrHome = createTempDir();
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setupTest() {
|
|
||||||
solrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllInfoPresent() throws IOException {
|
public void testAllInfoPresent() throws IOException {
|
||||||
|
|
|
@ -57,7 +57,7 @@ import com.google.common.base.Charsets;
|
||||||
|
|
||||||
public class TestSolrXmlPersistence extends SolrTestCaseJ4 {
|
public class TestSolrXmlPersistence extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private File solrHomeDirectory;
|
private File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public TestRule solrTestRules =
|
public TestRule solrTestRules =
|
||||||
|
@ -69,8 +69,6 @@ public class TestSolrXmlPersistence extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CoreContainer init(String solrXmlString, String... subDirs) throws Exception {
|
private CoreContainer init(String solrXmlString, String... subDirs) throws Exception {
|
||||||
createTempDir();
|
|
||||||
solrHomeDirectory = dataDir;
|
|
||||||
|
|
||||||
for (String s : subDirs) {
|
for (String s : subDirs) {
|
||||||
copyMinConf(new File(solrHomeDirectory, s));
|
copyMinConf(new File(solrHomeDirectory, s));
|
||||||
|
|
|
@ -22,8 +22,6 @@ import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -64,7 +62,8 @@ public class TestSolrXmlPersistor extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
final String solrxml = "<solr><cores></cores></solr>";
|
final String solrxml = "<solr><cores></cores></solr>";
|
||||||
|
|
||||||
final File solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
final File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (solrHomeDirectory.exists()) {
|
if (solrHomeDirectory.exists()) {
|
||||||
FileUtils.deleteDirectory(solrHomeDirectory);
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
|
|
|
@ -17,23 +17,17 @@
|
||||||
|
|
||||||
package org.apache.solr.handler;
|
package org.apache.solr.handler;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.util.NamedList;
|
import org.apache.solr.common.util.NamedList;
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
import org.apache.solr.response.SolrQueryResponse;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Ignore;
|
|
||||||
|
|
||||||
public class PingRequestHandlerTest extends SolrTestCaseJ4 {
|
public class PingRequestHandlerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
|
@ -48,14 +42,14 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() throws IOException {
|
public void before() throws IOException {
|
||||||
|
File tmpDir = initCoreDataDir;
|
||||||
// by default, use relative file in dataDir
|
// by default, use relative file in dataDir
|
||||||
healthcheckFile = new File(dataDir, fileName);
|
healthcheckFile = new File(tmpDir, fileName);
|
||||||
String fileNameParam = fileName;
|
String fileNameParam = fileName;
|
||||||
|
|
||||||
// sometimes randomly use an absolute File path instead
|
// sometimes randomly use an absolute File path instead
|
||||||
if (random().nextBoolean()) {
|
if (random().nextBoolean()) {
|
||||||
healthcheckFile = TestUtil.createTempFile(fileName, "");
|
healthcheckFile = new File(tmpDir, fileName);
|
||||||
fileNameParam = healthcheckFile.getAbsolutePath();
|
fileNameParam = healthcheckFile.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +79,10 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
|
||||||
assertEquals("OK", rsp.getValues().get("status"));
|
assertEquals("OK", rsp.getValues().get("status"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEnablingServer() throws Exception {
|
public void testEnablingServer() throws Exception {
|
||||||
|
|
||||||
assertTrue(! healthcheckFile.exists());
|
assertTrue(!healthcheckFile.exists());
|
||||||
|
|
||||||
// first make sure that ping responds back that the service is disabled
|
// first make sure that ping responds back that the service is disabled
|
||||||
SolrQueryResponse sqr = makeRequest(handler, req());
|
SolrQueryResponse sqr = makeRequest(handler, req());
|
||||||
|
|
|
@ -1595,7 +1595,9 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
||||||
System.setProperty("solr.test.sys.prop1", "propone");
|
System.setProperty("solr.test.sys.prop1", "propone");
|
||||||
System.setProperty("solr.test.sys.prop2", "proptwo");
|
System.setProperty("solr.test.sys.prop2", "proptwo");
|
||||||
|
|
||||||
File home = TestUtil.createTempDir(getClass().getName());
|
File home = new File(dataDir,
|
||||||
|
getClass().getName() + "-" +
|
||||||
|
System.currentTimeMillis());
|
||||||
|
|
||||||
homeDir = new File(home, name);
|
homeDir = new File(home, name);
|
||||||
dataDir = new File(homeDir + "/collection1", "data");
|
dataDir = new File(homeDir + "/collection1", "data");
|
||||||
|
|
|
@ -17,9 +17,14 @@
|
||||||
|
|
||||||
package org.apache.solr.handler.admin;
|
package org.apache.solr.handler.admin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.params.CoreAdminParams;
|
import org.apache.solr.common.params.CoreAdminParams;
|
||||||
|
@ -30,12 +35,6 @@ import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {
|
public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static File solrHomeDirectory = null;
|
private static File solrHomeDirectory = null;
|
||||||
|
@ -50,7 +49,7 @@ public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
useFactory(null); // I require FS-based indexes for this test.
|
useFactory(null); // I require FS-based indexes for this test.
|
||||||
|
|
||||||
solrHomeDirectory = TestUtil.createTempDir(CoreAdminCreateDiscoverTest.getClassName());
|
solrHomeDirectory = createTempDir();
|
||||||
if (solrHomeDirectory.exists()) {
|
if (solrHomeDirectory.exists()) {
|
||||||
FileUtils.deleteDirectory(solrHomeDirectory);
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.codec.Charsets;
|
import org.apache.commons.codec.Charsets;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||||
|
@ -61,7 +59,7 @@ public class CoreAdminHandlerTest extends SolrTestCaseJ4 {
|
||||||
public void testCreateWithSysVars() throws Exception {
|
public void testCreateWithSysVars() throws Exception {
|
||||||
useFactory(null); // I require FS-based indexes for this test.
|
useFactory(null); // I require FS-based indexes for this test.
|
||||||
|
|
||||||
final File workDir = TestUtil.createTempDir(getCoreName());
|
final File workDir = createTempDir(getCoreName());
|
||||||
|
|
||||||
String coreName = "with_sys_vars";
|
String coreName = "with_sys_vars";
|
||||||
File instDir = new File(workDir, coreName);
|
File instDir = new File(workDir, coreName);
|
||||||
|
@ -132,7 +130,7 @@ public class CoreAdminHandlerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCoreAdminHandler() throws Exception {
|
public void testCoreAdminHandler() throws Exception {
|
||||||
final File workDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
final File workDir = new File(initCoreDataDir, this.getClass().getName());
|
||||||
|
|
||||||
if (workDir.exists()) {
|
if (workDir.exists()) {
|
||||||
FileUtils.deleteDirectory(workDir);
|
FileUtils.deleteDirectory(workDir);
|
||||||
|
@ -223,7 +221,9 @@ public class CoreAdminHandlerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteInstanceDir() throws Exception {
|
public void testDeleteInstanceDir() throws Exception {
|
||||||
File solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File solrHomeDirectory = new File(initCoreDataDir, getClass().getName() + "-corex-"
|
||||||
|
+ System.currentTimeMillis());
|
||||||
|
solrHomeDirectory.mkdirs();
|
||||||
copySolrHomeToTemp(solrHomeDirectory, "corex", true);
|
copySolrHomeToTemp(solrHomeDirectory, "corex", true);
|
||||||
File corex = new File(solrHomeDirectory, "corex");
|
File corex = new File(solrHomeDirectory, "corex");
|
||||||
FileUtils.write(new File(corex, "core.properties"), "", Charsets.UTF_8.toString());
|
FileUtils.write(new File(corex, "core.properties"), "", Charsets.UTF_8.toString());
|
||||||
|
|
|
@ -20,8 +20,6 @@ package org.apache.solr.handler.admin;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.params.CoreAdminParams;
|
import org.apache.solr.common.params.CoreAdminParams;
|
||||||
import org.apache.solr.core.CoreContainer;
|
import org.apache.solr.core.CoreContainer;
|
||||||
|
@ -39,7 +37,8 @@ public class CoreAdminRequestStatusTest extends SolrTestCaseJ4{
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCoreAdminRequestStatus() throws Exception {
|
public void testCoreAdminRequestStatus() throws Exception {
|
||||||
final File workDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
final File workDir = createTempDir();
|
||||||
|
|
||||||
final CoreContainer cores = h.getCoreContainer();
|
final CoreContainer cores = h.getCoreContainer();
|
||||||
|
|
||||||
final CoreAdminHandler admin = new CoreAdminHandler(cores);
|
final CoreAdminHandler admin = new CoreAdminHandler(cores);
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class CoreMergeIndexesAdminHandlerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergeIndexesCoreAdminHandler() throws Exception {
|
public void testMergeIndexesCoreAdminHandler() throws Exception {
|
||||||
final File workDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
final File workDir = createTempDir();
|
||||||
|
|
||||||
if (workDir.exists()) {
|
if (workDir.exists()) {
|
||||||
FileUtils.deleteDirectory(workDir);
|
FileUtils.deleteDirectory(workDir);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class DistributedDebugComponentTest extends SolrJettyTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File createSolrHome() throws Exception {
|
private static File createSolrHome() throws Exception {
|
||||||
File workDir = TestUtil.createTempDir(DistributedDebugComponentTest.class.getName());
|
File workDir = new File(createTempDir(), DistributedDebugComponentTest.class.getName());
|
||||||
setupJettyTestHome(workDir, "collection1");
|
setupJettyTestHome(workDir, "collection1");
|
||||||
FileUtils.copyDirectory(new File(workDir, "collection1"), new File(workDir, "collection2"));
|
FileUtils.copyDirectory(new File(workDir, "collection1"), new File(workDir, "collection2"));
|
||||||
return workDir;
|
return workDir;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.BaseDistributedSearchTestCase;
|
import org.apache.solr.BaseDistributedSearchTestCase;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
|
@ -40,6 +41,7 @@ import org.junit.BeforeClass;
|
||||||
* @see org.apache.solr.handler.component.SpellCheckComponent
|
* @see org.apache.solr.handler.component.SpellCheckComponent
|
||||||
*/
|
*/
|
||||||
@Slow
|
@Slow
|
||||||
|
@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
|
||||||
public class DistributedSpellCheckComponentTest extends BaseDistributedSearchTestCase {
|
public class DistributedSpellCheckComponentTest extends BaseDistributedSearchTestCase {
|
||||||
|
|
||||||
public DistributedSpellCheckComponentTest()
|
public DistributedSpellCheckComponentTest()
|
||||||
|
|
|
@ -57,10 +57,9 @@ public class QueryElevationComponentTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private void init(String config, String schema) throws Exception {
|
private void init(String config, String schema) throws Exception {
|
||||||
//write out elevate-data.xml to the Data dir first by copying it from conf, which we know exists, this way we can test both conf and data configurations
|
//write out elevate-data.xml to the Data dir first by copying it from conf, which we know exists, this way we can test both conf and data configurations
|
||||||
createTempDir();
|
|
||||||
File parent = new File(TEST_HOME() + "/collection1", "conf");
|
File parent = new File(TEST_HOME() + "/collection1", "conf");
|
||||||
File elevateFile = new File(parent, "elevate.xml");
|
File elevateFile = new File(parent, "elevate.xml");
|
||||||
File elevateDataFile = new File(dataDir, "elevate-data.xml");
|
File elevateDataFile = new File(initCoreDataDir, "elevate-data.xml");
|
||||||
FileUtils.copyFile(elevateFile, elevateDataFile);
|
FileUtils.copyFile(elevateFile, elevateDataFile);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ import java.util.TreeMap;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.util.RestTestBase;
|
import org.apache.solr.util.RestTestBase;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -42,8 +40,7 @@ public class TestManagedSchemaFieldResource extends RestTestBase {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() throws Exception {
|
public void before() throws Exception {
|
||||||
createTempDir();
|
tmpSolrHome = createTempDir();
|
||||||
tmpSolrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
tmpConfDir = new File(tmpSolrHome, confDir);
|
tmpConfDir = new File(tmpSolrHome, confDir);
|
||||||
FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
|
FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class TestManagedStopFilterFactory extends RestTestBase {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() throws Exception {
|
public void before() throws Exception {
|
||||||
createTempDir();
|
tmpSolrHome = new File(createTempDir() + File.separator + TestManagedStopFilterFactory.class.getSimpleName()
|
||||||
tmpSolrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
+ System.currentTimeMillis());
|
||||||
tmpConfDir = new File(tmpSolrHome, confDir);
|
tmpConfDir = new File(tmpSolrHome, confDir);
|
||||||
FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
|
FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.codec.Charsets;
|
import org.apache.commons.codec.Charsets;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.util.NamedList;
|
import org.apache.solr.common.util.NamedList;
|
||||||
import org.apache.solr.core.CoreContainer;
|
import org.apache.solr.core.CoreContainer;
|
||||||
|
@ -42,7 +40,7 @@ public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
|
||||||
initCore();
|
initCore();
|
||||||
}
|
}
|
||||||
|
|
||||||
private File solrHomeDirectory;
|
private final File solrHomeDirectory = createTempDir();
|
||||||
private File schemaFile = null;
|
private File schemaFile = null;
|
||||||
|
|
||||||
private void addDoc(SolrCore core, String... fieldValues) throws IOException {
|
private void addDoc(SolrCore core, String... fieldValues) throws IOException {
|
||||||
|
@ -53,7 +51,6 @@ public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CoreContainer init() throws Exception {
|
private CoreContainer init() throws Exception {
|
||||||
solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
File changed = new File(solrHomeDirectory, "changed");
|
File changed = new File(solrHomeDirectory, "changed");
|
||||||
copyMinConf(changed, "name=changed");
|
copyMinConf(changed, "name=changed");
|
||||||
// Overlay with my local schema
|
// Overlay with my local schema
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.junit.rules.TestRule;
|
||||||
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
||||||
|
|
||||||
public class ModifyConfFileTest extends SolrTestCaseJ4 {
|
public class ModifyConfFileTest extends SolrTestCaseJ4 {
|
||||||
private File solrHomeDirectory;
|
private File solrHomeDirectory = createTempDir();
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public TestRule solrTestRules = RuleChain.outerRule(new SystemPropertiesRestoreRule());
|
public TestRule solrTestRules = RuleChain.outerRule(new SystemPropertiesRestoreRule());
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
|
@ -36,7 +35,8 @@ public class TestBinaryField extends SolrJettyTestBase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTest() throws Exception {
|
public static void beforeTest() throws Exception {
|
||||||
File homeDir = TestUtil.createTempDir("solrtest-TestBinaryField");
|
File homeDir = createTempDir();
|
||||||
|
|
||||||
File collDir = new File(homeDir, "collection1");
|
File collDir = new File(homeDir, "collection1");
|
||||||
File dataDir = new File(collDir, "data");
|
File dataDir = new File(collDir, "data");
|
||||||
File confDir = new File(collDir, "conf");
|
File confDir = new File(collDir, "conf");
|
||||||
|
|
|
@ -48,8 +48,7 @@ public class TestManagedSchema extends AbstractBadConfigTestBase {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
private void initManagedSchemaCore() throws Exception {
|
private void initManagedSchemaCore() throws Exception {
|
||||||
createTempDir();
|
final String tmpSolrHomePath = createTempDir().getAbsolutePath();
|
||||||
final String tmpSolrHomePath = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
|
||||||
tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
|
tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
|
||||||
tmpConfDir = new File(tmpSolrHome, confDir);
|
tmpConfDir = new File(tmpSolrHome, confDir);
|
||||||
File testHomeConfDir = new File(TEST_HOME(), confDir);
|
File testHomeConfDir = new File(TEST_HOME(), confDir);
|
||||||
|
|
|
@ -21,8 +21,6 @@ import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.schema.IndexSchema;
|
import org.apache.solr.schema.IndexSchema;
|
||||||
import org.apache.solr.schema.SchemaField;
|
import org.apache.solr.schema.SchemaField;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -37,8 +35,7 @@ public class TestAddFieldRealTimeGet extends TestRTGBase {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
private void initManagedSchemaCore() throws Exception {
|
private void initManagedSchemaCore() throws Exception {
|
||||||
createTempDir();
|
final String tmpSolrHomePath = createTempDir().getAbsolutePath();
|
||||||
final String tmpSolrHomePath = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
|
||||||
tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
|
tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
|
||||||
tmpConfDir = new File(tmpSolrHome, confDir);
|
tmpConfDir = new File(tmpSolrHome, confDir);
|
||||||
File testHomeConfDir = new File(TEST_HOME(), confDir);
|
File testHomeConfDir = new File(TEST_HOME(), confDir);
|
||||||
|
|
|
@ -40,8 +40,6 @@ import org.apache.hadoop.fs.FSDataOutputStream;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.cloud.hdfs.HdfsBasicDistributedZk2Test;
|
import org.apache.solr.cloud.hdfs.HdfsBasicDistributedZk2Test;
|
||||||
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
|
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
|
||||||
|
@ -78,7 +76,9 @@ public class TestRecoveryHdfs extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
dfsCluster = HdfsTestUtil.setupClass(new File(createTempDir(),
|
||||||
|
HdfsBasicDistributedZk2Test.class.getName() + "_"
|
||||||
|
+ System.currentTimeMillis()).getAbsolutePath());
|
||||||
hdfsUri = dfsCluster.getFileSystem().getUri().toString();
|
hdfsUri = dfsCluster.getFileSystem().getUri().toString();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -16,23 +16,17 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.solr.search;
|
package org.apache.solr.search;
|
||||||
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
|
||||||
import org.apache.solr.common.util.NamedList;
|
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
|
||||||
import org.apache.solr.schema.SchemaField;
|
|
||||||
import org.apache.solr.schema.IndexSchema;
|
|
||||||
import org.apache.solr.schema.ManagedIndexSchema;
|
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
|
import org.apache.solr.schema.IndexSchema;
|
||||||
|
import org.apache.solr.schema.ManagedIndexSchema;
|
||||||
|
import org.apache.solr.schema.SchemaField;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests to open a new searcher w/o any underlying change to the index exposed
|
* Requests to open a new searcher w/o any underlying change to the index exposed
|
||||||
|
@ -55,8 +49,7 @@ public class TestSearcherReuse extends SolrTestCaseJ4 {
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
private static void setupTempDirAndCoreWithManagedSchema() throws Exception {
|
private static void setupTempDirAndCoreWithManagedSchema() throws Exception {
|
||||||
createTempDir();
|
solrHome = createTempDir();
|
||||||
solrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
|
||||||
solrHome = solrHome.getAbsoluteFile();
|
solrHome = solrHome.getAbsoluteFile();
|
||||||
|
|
||||||
File confDir = new File(solrHome, confPath);
|
File confDir = new File(solrHome, confPath);
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.solr.servlet;
|
package org.apache.solr.servlet;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
|
@ -43,7 +45,7 @@ public class CacheHeaderTest extends CacheHeaderTestBase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTest() throws Exception {
|
public static void beforeTest() throws Exception {
|
||||||
solrHomeDirectory = TestUtil.createTempDir("CacheHeaderTest");
|
solrHomeDirectory = new File(createTempDir(), "CacheHeaderTest");
|
||||||
setupJettyTestHome(solrHomeDirectory, "collection1");
|
setupJettyTestHome(solrHomeDirectory, "collection1");
|
||||||
createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
|
createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +256,7 @@ public class CacheHeaderTest extends CacheHeaderTestBase {
|
||||||
|
|
||||||
protected File makeFile(String contents, String charset) {
|
protected File makeFile(String contents, String charset) {
|
||||||
try {
|
try {
|
||||||
File f = TestUtil.createTempFile("cachetest_csv", null);
|
File f = TestUtil.createTempFile("cachetest_csv", null, initCoreDataDir);
|
||||||
Writer out = new OutputStreamWriter(new FileOutputStream(f), charset);
|
Writer out = new OutputStreamWriter(new FileOutputStream(f), charset);
|
||||||
out.write(contents);
|
out.write(contents);
|
||||||
out.close();
|
out.close();
|
||||||
|
|
|
@ -23,15 +23,12 @@ import java.util.Map;
|
||||||
import org.apache.lucene.analysis.Token;
|
import org.apache.lucene.analysis.Token;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
|
import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
|
||||||
import org.apache.solr.common.params.CommonParams;
|
|
||||||
import org.apache.solr.common.params.SpellingParams;
|
import org.apache.solr.common.params.SpellingParams;
|
||||||
import org.apache.solr.common.util.NamedList;
|
import org.apache.solr.common.util.NamedList;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.handler.component.SpellCheckComponent;
|
import org.apache.solr.handler.component.SpellCheckComponent;
|
||||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
|
||||||
import org.apache.solr.search.SolrIndexSearcher;
|
import org.apache.solr.search.SolrIndexSearcher;
|
||||||
import org.apache.solr.util.RefCounted;
|
import org.apache.solr.util.RefCounted;
|
||||||
import org.apache.solr.util.TestHarness;
|
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.lucene.analysis.Token;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.TestUtil;
|
import org.apache.lucene.util.TestUtil;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
|
import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
|
||||||
import org.apache.solr.common.util.NamedList;
|
import org.apache.solr.common.util.NamedList;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.search.SolrIndexSearcher;
|
import org.apache.solr.search.SolrIndexSearcher;
|
||||||
|
@ -37,6 +38,7 @@ import org.junit.Test;
|
||||||
*
|
*
|
||||||
* @since solr 1.3
|
* @since solr 1.3
|
||||||
**/
|
**/
|
||||||
|
@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
|
||||||
public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static SpellingQueryConverter queryConverter;
|
private static SpellingQueryConverter queryConverter;
|
||||||
|
@ -104,7 +106,8 @@ public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.LOCATION, "spellings.txt");
|
spellchecker.add(AbstractLuceneSpellChecker.LOCATION, "spellings.txt");
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "teststop");
|
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "teststop");
|
||||||
spellchecker.add(FileBasedSpellChecker.SOURCE_FILE_CHAR_ENCODING, "UTF-8");
|
spellchecker.add(FileBasedSpellChecker.SOURCE_FILE_CHAR_ENCODING, "UTF-8");
|
||||||
File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File indexDir = new File(createTempDir(), "spellingIdx");
|
||||||
|
indexDir.mkdirs();
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
||||||
spellchecker.add(SolrSpellChecker.FIELD_TYPE, "teststop");
|
spellchecker.add(SolrSpellChecker.FIELD_TYPE, "teststop");
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
||||||
|
|
|
@ -37,9 +37,8 @@ import org.apache.lucene.search.spell.SuggestMode;
|
||||||
import org.apache.lucene.search.spell.SuggestWord;
|
import org.apache.lucene.search.spell.SuggestWord;
|
||||||
import org.apache.lucene.search.spell.SuggestWordFrequencyComparator;
|
import org.apache.lucene.search.spell.SuggestWordFrequencyComparator;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
|
import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
|
||||||
import org.apache.solr.common.util.NamedList;
|
import org.apache.solr.common.util.NamedList;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.handler.component.SpellCheckComponent;
|
import org.apache.solr.handler.component.SpellCheckComponent;
|
||||||
|
@ -52,6 +51,7 @@ import org.junit.Test;
|
||||||
/**
|
/**
|
||||||
* @since solr 1.3
|
* @since solr 1.3
|
||||||
*/
|
*/
|
||||||
|
@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
|
||||||
public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
||||||
protected static SpellingQueryConverter queryConverter;
|
protected static SpellingQueryConverter queryConverter;
|
||||||
|
|
||||||
|
@ -110,7 +110,8 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
||||||
NamedList spellchecker = new NamedList();
|
NamedList spellchecker = new NamedList();
|
||||||
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
||||||
|
|
||||||
File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File indexDir = createTempDir();
|
||||||
|
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
|
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
||||||
|
@ -185,7 +186,8 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
||||||
NamedList spellchecker = new NamedList();
|
NamedList spellchecker = new NamedList();
|
||||||
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
||||||
|
|
||||||
File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File indexDir = new File(createTempDir(), "spellingIdx");
|
||||||
|
indexDir.mkdirs();
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
|
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
||||||
|
@ -241,7 +243,8 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
||||||
NamedList spellchecker = new NamedList();
|
NamedList spellchecker = new NamedList();
|
||||||
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
||||||
|
|
||||||
File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File indexDir = createTempDir();
|
||||||
|
indexDir.mkdirs();
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
|
spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
|
||||||
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
|
||||||
|
@ -279,11 +282,11 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
|
||||||
IndexBasedSpellChecker checker = new IndexBasedSpellChecker();
|
IndexBasedSpellChecker checker = new IndexBasedSpellChecker();
|
||||||
NamedList spellchecker = new NamedList();
|
NamedList spellchecker = new NamedList();
|
||||||
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
|
||||||
|
|
||||||
File base = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmpDir = createTempDir();
|
||||||
File indexDir = new File(base, "spellingIdx");
|
File indexDir = new File(tmpDir, "spellingIdx");
|
||||||
//create a standalone index
|
//create a standalone index
|
||||||
File altIndexDir = new File(base, "alternateIdx");
|
File altIndexDir = new File(tmpDir, "alternateIdx" + new Date().getTime());
|
||||||
Directory dir = newFSDirectory(altIndexDir);
|
Directory dir = newFSDirectory(altIndexDir);
|
||||||
IndexWriter iw = new IndexWriter(
|
IndexWriter iw = new IndexWriter(
|
||||||
dir,
|
dir,
|
||||||
|
|
|
@ -82,10 +82,10 @@ public class SuggesterTest extends SolrTestCaseJ4 {
|
||||||
System.setProperty("solr.test.leavedatadir", "true");
|
System.setProperty("solr.test.leavedatadir", "true");
|
||||||
addDocs();
|
addDocs();
|
||||||
assertU(commit());
|
assertU(commit());
|
||||||
File data = dataDir;
|
File data = initCoreDataDir;
|
||||||
String config = configString;
|
String config = configString;
|
||||||
deleteCore();
|
deleteCore();
|
||||||
dataDir = data;
|
initCoreDataDir = data;
|
||||||
configString = config;
|
configString = config;
|
||||||
initCore();
|
initCore();
|
||||||
assertQ(req("qt", requestUri, "q", "ac", SpellingParams.SPELLCHECK_COUNT, "2", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
|
assertQ(req("qt", requestUri, "q", "ac", SpellingParams.SPELLCHECK_COUNT, "2", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
|
||||||
|
|
|
@ -30,14 +30,16 @@ import org.apache.lucene.store.IndexInput;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
import org.apache.lucene.store.MergeInfo;
|
import org.apache.lucene.store.MergeInfo;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
|
import org.apache.solr.store.hdfs.HdfsDirectory;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
||||||
|
|
||||||
public class BlockDirectoryTest extends LuceneTestCase {
|
public class BlockDirectoryTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private class MapperCache implements Cache {
|
private class MapperCache implements Cache {
|
||||||
public Map<String, byte[]> map = new ConcurrentLinkedHashMap.Builder<String, byte[]>().maximumWeightedCapacity(8).build();
|
public Map<String, byte[]> map = new ConcurrentLinkedHashMap.Builder<String, byte[]>().maximumWeightedCapacity(8).build();
|
||||||
|
@ -103,7 +105,7 @@ public class BlockDirectoryTest extends LuceneTestCase {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
file = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
file = createTempDir();
|
||||||
FSDirectory dir = FSDirectory.open(new File(file, "base"));
|
FSDirectory dir = FSDirectory.open(new File(file, "base"));
|
||||||
mapperCache = new MapperCache();
|
mapperCache = new MapperCache();
|
||||||
directory = new BlockDirectory("test", dir, mapperCache, null, true, true);
|
directory = new BlockDirectory("test", dir, mapperCache, null, true, true);
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.apache.solr.store.hdfs;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -31,8 +30,6 @@ import org.apache.lucene.store.IOContext;
|
||||||
import org.apache.lucene.store.IndexInput;
|
import org.apache.lucene.store.IndexInput;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.RAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
|
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -60,8 +57,7 @@ public class HdfsDirectoryTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
createTempDir();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
@ -77,7 +73,7 @@ public class HdfsDirectoryTest extends SolrTestCaseJ4 {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.set("dfs.permissions.enabled", "false");
|
conf.set("dfs.permissions.enabled", "false");
|
||||||
|
|
||||||
directory = new HdfsDirectory(new Path(dfsCluster.getURI().toString() + dataDir.getAbsolutePath() + "/hdfs"), conf);
|
directory = new HdfsDirectory(new Path(dfsCluster.getURI().toString() + createTempDir().getAbsolutePath() + "/hdfs"), conf);
|
||||||
|
|
||||||
random = random();
|
random = random();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ package org.apache.solr.store.hdfs;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
@ -24,7 +25,6 @@ import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.lucene.store.Lock;
|
import org.apache.lucene.store.Lock;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
|
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -43,8 +43,7 @@ public class HdfsLockFactoryTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
createTempDir();
|
dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
|
||||||
dfsCluster = HdfsTestUtil.setupClass();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -25,8 +25,6 @@ import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.index.DirectoryReader;
|
import org.apache.lucene.index.DirectoryReader;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
|
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
|
||||||
|
@ -59,10 +57,13 @@ public class SolrIndexSplitterTest extends SolrTestCaseJ4 {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
clearIndex();
|
clearIndex();
|
||||||
assertU(commit());
|
assertU(commit());
|
||||||
File tempDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File dataDir = createTempDir();
|
||||||
indexDir1 = new File(tempDir, this.getClass().getName() + "_testSplit1");
|
indexDir1 = new File(dataDir, this.getClass().getName()
|
||||||
indexDir2 = new File(tempDir, this.getClass().getName() + "_testSplit2");
|
+ "_testSplit1");
|
||||||
indexDir3 = new File(tempDir, this.getClass().getName() + "_testSplit3");
|
indexDir2 = new File(dataDir, this.getClass().getName()
|
||||||
|
+ "_testSplit2");
|
||||||
|
indexDir3 = new File(dataDir, this.getClass().getName()
|
||||||
|
+ "_testSplit3");
|
||||||
|
|
||||||
if (indexDir1.exists()) {
|
if (indexDir1.exists()) {
|
||||||
FileUtils.deleteDirectory(indexDir1);
|
FileUtils.deleteDirectory(indexDir1);
|
||||||
|
@ -270,7 +271,11 @@ public class SolrIndexSplitterTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSplitByRouteKey() throws Exception {
|
public void testSplitByRouteKey() throws Exception {
|
||||||
File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File indexDir = createTempDir();
|
||||||
|
if (indexDir.exists()) {
|
||||||
|
FileUtils.deleteDirectory(indexDir);
|
||||||
|
}
|
||||||
|
indexDir.mkdirs();
|
||||||
|
|
||||||
CompositeIdRouter r1 = new CompositeIdRouter();
|
CompositeIdRouter r1 = new CompositeIdRouter();
|
||||||
String splitKey = "sea-line!";
|
String splitKey = "sea-line!";
|
||||||
|
|
|
@ -49,8 +49,7 @@ public class AddSchemaFieldsUpdateProcessorFactoryTest extends UpdateProcessorTe
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
private void initManagedSchemaCore() throws Exception {
|
private void initManagedSchemaCore() throws Exception {
|
||||||
createTempDir();
|
final String tmpSolrHomePath = createTempDir().getAbsolutePath();
|
||||||
final String tmpSolrHomePath = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
|
|
||||||
tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
|
tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
|
||||||
tmpConfDir = new File(tmpSolrHome, confDir);
|
tmpConfDir = new File(tmpSolrHome, confDir);
|
||||||
File testHomeConfDir = new File(TEST_HOME(), confDir);
|
File testHomeConfDir = new File(TEST_HOME(), confDir);
|
||||||
|
|
|
@ -21,9 +21,6 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
|
||||||
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
|
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
|
||||||
import org.apache.solr.client.solrj.request.CoreAdminRequest;
|
import org.apache.solr.client.solrj.request.CoreAdminRequest;
|
||||||
import org.apache.solr.client.solrj.request.QueryRequest;
|
import org.apache.solr.client.solrj.request.QueryRequest;
|
||||||
|
@ -46,6 +43,7 @@ public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
|
||||||
|
|
||||||
protected CoreContainer cores;
|
protected CoreContainer cores;
|
||||||
private String saveProp;
|
private String saveProp;
|
||||||
|
private File dataDir1;
|
||||||
private File dataDir2;
|
private File dataDir2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,9 +53,7 @@ public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass2() throws Exception {
|
public static void beforeClass2() throws Exception {
|
||||||
if (dataDir == null) {
|
|
||||||
createTempDir();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupCoreContainer() {
|
protected void setupCoreContainer() {
|
||||||
|
@ -71,12 +67,11 @@ public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
|
||||||
saveProp = System.getProperty("solr.directoryFactory");
|
saveProp = System.getProperty("solr.directoryFactory");
|
||||||
System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");
|
System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
File dataDir1 = createTempDir();
|
||||||
// setup datadirs
|
// setup datadirs
|
||||||
System.setProperty( "solr.core0.data.dir", SolrTestCaseJ4.dataDir.getCanonicalPath() );
|
System.setProperty( "solr.core0.data.dir", dataDir1.getCanonicalPath() );
|
||||||
|
|
||||||
dataDir2 = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
dataDir2 = createTempDir();
|
||||||
dataDir2.mkdirs();
|
|
||||||
|
|
||||||
System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
|
System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,9 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
|
||||||
|
|
||||||
@Override public void setUp() throws Exception {
|
@Override public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
dataDir1 = createTempDir();
|
||||||
dataDir1 = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "-core0");
|
dataDir2 = createTempDir();
|
||||||
dataDir2 = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "-core1");
|
|
||||||
|
|
||||||
System.setProperty( "solr.core0.data.dir", this.dataDir1.getCanonicalPath() );
|
System.setProperty( "solr.core0.data.dir", this.dataDir1.getCanonicalPath() );
|
||||||
System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
|
System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,7 @@ abstract public class SolrExampleTestBase extends AbstractSolrTestCase
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
if (dataDir == null) {
|
|
||||||
createTempDir();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +47,7 @@ abstract public class SolrExampleTestBase extends AbstractSolrTestCase
|
||||||
|
|
||||||
// this sets the property for jetty starting SolrDispatchFilter
|
// this sets the property for jetty starting SolrDispatchFilter
|
||||||
System.setProperty( "solr.solr.home", this.getSolrHome() );
|
System.setProperty( "solr.solr.home", this.getSolrHome() );
|
||||||
System.setProperty( "solr.data.dir", this.dataDir.getCanonicalPath() );
|
System.setProperty( "solr.data.dir", this.initCoreDataDir.getCanonicalPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -285,7 +285,8 @@ public class TestLBHttpSolrServer extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
File home = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File home = new File(dataDir,
|
||||||
|
getClass().getName() + "-" + System.currentTimeMillis());
|
||||||
homeDir = new File(home, name);
|
homeDir = new File(home, name);
|
||||||
dataDir = new File(homeDir + "/collection1", "data");
|
dataDir = new File(homeDir + "/collection1", "data");
|
||||||
confDir = new File(homeDir + "/collection1", "conf");
|
confDir = new File(homeDir + "/collection1", "conf");
|
||||||
|
|
|
@ -17,20 +17,17 @@ package org.apache.solr.client.solrj.embedded;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import java.io.File;
|
||||||
import org.apache.lucene.util.TestUtil;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
import org.apache.solr.core.CoreContainer;
|
import org.apache.solr.core.CoreContainer;
|
||||||
import org.apache.solr.util.AbstractSolrTestCase;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
public abstract class AbstractEmbeddedSolrServerTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
public abstract class AbstractEmbeddedSolrServerTestCase extends LuceneTestCase {
|
|
||||||
|
|
||||||
protected static Logger log = LoggerFactory.getLogger(AbstractEmbeddedSolrServerTestCase.class);
|
protected static Logger log = LoggerFactory.getLogger(AbstractEmbeddedSolrServerTestCase.class);
|
||||||
|
|
||||||
|
@ -49,7 +46,7 @@ public abstract class AbstractEmbeddedSolrServerTestCase extends LuceneTestCase
|
||||||
System.out.println("Solr home: " + SOLR_HOME.getAbsolutePath());
|
System.out.println("Solr home: " + SOLR_HOME.getAbsolutePath());
|
||||||
|
|
||||||
//The index is always stored within a temporary directory
|
//The index is always stored within a temporary directory
|
||||||
tempDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
tempDir = createTempDir();
|
||||||
|
|
||||||
File dataDir = new File(tempDir,"data1");
|
File dataDir = new File(tempDir,"data1");
|
||||||
File dataDir2 = new File(tempDir,"data2");
|
File dataDir2 = new File(tempDir,"data2");
|
||||||
|
|
|
@ -59,7 +59,9 @@ public class JettyWebappTest extends SolrTestCaseJ4
|
||||||
System.setProperty("solr.solr.home", ExternalPaths.EXAMPLE_HOME);
|
System.setProperty("solr.solr.home", ExternalPaths.EXAMPLE_HOME);
|
||||||
System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
|
System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
|
||||||
|
|
||||||
File dataDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File dataDir = createTempDir();
|
||||||
|
dataDir.mkdirs();
|
||||||
|
|
||||||
System.setProperty("solr.data.dir", dataDir.getCanonicalPath());
|
System.setProperty("solr.data.dir", dataDir.getCanonicalPath());
|
||||||
String path = ExternalPaths.WEBAPP_HOME;
|
String path = ExternalPaths.WEBAPP_HOME;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {
|
||||||
|
|
||||||
SolrServer server = getSolrAdmin();
|
SolrServer server = getSolrAdmin();
|
||||||
|
|
||||||
File tmp = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
File tmp = createTempDir();
|
||||||
|
|
||||||
log.info("Creating cores underneath {}", tmp);
|
log.info("Creating cores underneath {}", tmp);
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,17 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.lucene.util.TestUtil;
|
import org.apache.lucene.util.TestUtil;
|
||||||
import org.apache.solr.core.SolrResourceLoader;
|
import org.apache.solr.core.SolrResourceLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class ContentStreamTest extends LuceneTestCase
|
public class ContentStreamTest extends SolrTestCaseJ4
|
||||||
{
|
{
|
||||||
public void testStringStream() throws IOException
|
public void testStringStream() throws IOException
|
||||||
{
|
{
|
||||||
|
@ -47,15 +48,26 @@ public class ContentStreamTest extends LuceneTestCase
|
||||||
{
|
{
|
||||||
InputStream is = new SolrResourceLoader(null, null).openResource( "solrj/README" );
|
InputStream is = new SolrResourceLoader(null, null).openResource( "solrj/README" );
|
||||||
assertNotNull( is );
|
assertNotNull( is );
|
||||||
File file = TestUtil.createTempFile("README", "");
|
File file = TestUtil.createTempFile("README", "", createTempDir());
|
||||||
FileOutputStream os = new FileOutputStream(file);
|
FileOutputStream os = new FileOutputStream(file);
|
||||||
IOUtils.copy(is, os);
|
IOUtils.copy(is, os);
|
||||||
os.close();
|
os.close();
|
||||||
|
is.close();
|
||||||
|
|
||||||
ContentStreamBase stream = new ContentStreamBase.FileStream( file );
|
ContentStreamBase stream = new ContentStreamBase.FileStream(file);
|
||||||
assertEquals( file.length(), stream.getSize().intValue() );
|
InputStream s = stream.getStream();
|
||||||
assertTrue( IOUtils.contentEquals( new FileInputStream( file ), stream.getStream() ) );
|
FileInputStream fis = new FileInputStream(file);
|
||||||
assertTrue( IOUtils.contentEquals( new InputStreamReader(new FileInputStream(file), "UTF-8"), stream.getReader() ) );
|
InputStreamReader isr = new InputStreamReader(
|
||||||
|
new FileInputStream(file), "UTF-8");
|
||||||
|
try {
|
||||||
|
assertEquals(file.length(), stream.getSize().intValue());
|
||||||
|
assertTrue(IOUtils.contentEquals(fis, s));
|
||||||
|
assertTrue(IOUtils.contentEquals(isr, stream.getReader()));
|
||||||
|
} finally {
|
||||||
|
s.close();
|
||||||
|
isr.close();
|
||||||
|
fis.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,15 +75,30 @@ public class ContentStreamTest extends LuceneTestCase
|
||||||
{
|
{
|
||||||
InputStream is = new SolrResourceLoader(null, null).openResource( "solrj/README" );
|
InputStream is = new SolrResourceLoader(null, null).openResource( "solrj/README" );
|
||||||
assertNotNull( is );
|
assertNotNull( is );
|
||||||
File file = TestUtil.createTempFile("README", "");
|
File file = new File(createTempDir(), "README");
|
||||||
FileOutputStream os = new FileOutputStream(file);
|
FileOutputStream os = new FileOutputStream(file);
|
||||||
IOUtils.copy(is, os);
|
IOUtils.copy(is, os);
|
||||||
os.close();
|
os.close();
|
||||||
|
is.close();
|
||||||
|
|
||||||
ContentStreamBase stream = new ContentStreamBase.URLStream( new URL(file.toURI().toASCIIString()) );
|
ContentStreamBase stream = new ContentStreamBase.URLStream(new URL(file
|
||||||
assertTrue( IOUtils.contentEquals( new FileInputStream( file ), stream.getStream() ) );
|
.toURI().toASCIIString()));
|
||||||
assertEquals( file.length(), stream.getSize().intValue() );
|
InputStream s = stream.getStream();
|
||||||
assertTrue( IOUtils.contentEquals( new InputStreamReader(new FileInputStream(file), "UTF-8"), stream.getReader() ) );
|
FileInputStream fis = new FileInputStream(file);
|
||||||
assertEquals( file.length(), stream.getSize().intValue() );
|
FileInputStream fis2 = new FileInputStream(file);
|
||||||
|
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
|
||||||
|
Reader r = stream.getReader();
|
||||||
|
try {
|
||||||
|
assertTrue(IOUtils.contentEquals(fis2, s));
|
||||||
|
assertEquals(file.length(), stream.getSize().intValue());
|
||||||
|
assertTrue(IOUtils.contentEquals(isr, r));
|
||||||
|
assertEquals(file.length(), stream.getSize().intValue());
|
||||||
|
} finally {
|
||||||
|
r.close();
|
||||||
|
s.close();
|
||||||
|
isr.close();
|
||||||
|
fis.close();
|
||||||
|
fis2.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,8 +278,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
System.setProperty("solr.test.sys.prop1", "propone");
|
System.setProperty("solr.test.sys.prop1", "propone");
|
||||||
System.setProperty("solr.test.sys.prop2", "proptwo");
|
System.setProperty("solr.test.sys.prop2", "proptwo");
|
||||||
testDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
|
testDir = createTempDir();
|
||||||
testDir.mkdirs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -56,7 +56,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
|
||||||
ignoreException("maxWarmingSearchers");
|
ignoreException("maxWarmingSearchers");
|
||||||
|
|
||||||
// this sets the property for jetty starting SolrDispatchFilter
|
// this sets the property for jetty starting SolrDispatchFilter
|
||||||
System.setProperty( "solr.data.dir", dataDir.getCanonicalPath() );
|
System.setProperty( "solr.data.dir", createTempDir().getCanonicalPath() );
|
||||||
|
|
||||||
context = context==null ? "/solr" : context;
|
context = context==null ? "/solr" : context;
|
||||||
SolrJettyTestBase.context = context;
|
SolrJettyTestBase.context = context;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue