SOLR-2011: change all uses of java.io.tmpdir -> TEMP_DIR

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@981650 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-08-02 18:24:32 +00:00
parent cf46248d35
commit b905aba624
9 changed files with 33 additions and 44 deletions

View File

@ -18,6 +18,7 @@ package org.apache.solr.handler.dataimport;
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.apache.solr.client.solrj.request.DirectXmlRequest;
@ -107,12 +108,11 @@ public class TestContentStreamDataSource extends TestCase {
public void setUp() throws Exception {
String home = System.getProperty("java.io.tmpdir")
+ File.separator
+ getClass().getName() + "-" + System.currentTimeMillis();
File home = new File(SolrTestCaseJ4.TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
homeDir = new File(home + "inst");
homeDir = new File(home, "inst");
dataDir = new File(homeDir, "data");
confDir = new File(homeDir, "conf");

View File

@ -116,9 +116,8 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
super.setUp();
System.setProperty("solr.test.sys.prop1", "propone");
System.setProperty("solr.test.sys.prop2", "proptwo");
testDir = new File(System.getProperty("java.io.tmpdir")
+ System.getProperty("file.separator")
+ getClass().getName() + "-" + System.currentTimeMillis());
testDir = new File(TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
testDir.mkdirs();
}

View File

@ -101,14 +101,12 @@ public class TestSolrCoreProperties extends AbstractSolrTestCase {
public void setUpMe() throws Exception {
String home = System.getProperty("java.io.tmpdir")
+ File.separator
+ getClass().getName() + "-" + System.currentTimeMillis();
homeDir = new File(TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
homeDir = new File(home);
dataDir = new File(home, "data");
confDir = new File(home, "conf");
dataDir = new File(homeDir, "data");
confDir = new File(homeDir, "conf");
homeDir.mkdirs();

View File

@ -21,6 +21,7 @@ import junit.framework.TestCase;
import junit.framework.Assert;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.io.FileUtils;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.apache.solr.client.solrj.impl.LBHttpSolrServer;
@ -188,9 +189,8 @@ public class TestLBHttpSolrServer extends TestCase {
}
public void setUp() throws Exception {
String home = System.getProperty("java.io.tmpdir")
+ File.separator
+ getClass().getName() + "-" + System.currentTimeMillis();
File home = new File(SolrTestCaseJ4.TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
homeDir = new File(home, name);

View File

@ -24,6 +24,7 @@ import java.util.Random;
import junit.framework.TestCase;
import org.apache.commons.io.IOUtils;
import org.apache.solr.SolrTestCaseJ4;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
@ -46,9 +47,8 @@ public class JettyWebappTest extends TestCase
{
System.setProperty("solr.solr.home", "../../../example/solr");
File dataDir = new File(System.getProperty("java.io.tmpdir")
+ System.getProperty("file.separator")
+ getClass().getName() + "-" + System.currentTimeMillis());
File dataDir = new File(SolrTestCaseJ4.TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
dataDir.mkdirs();
System.setProperty("solr.data.dir", dataDir.getCanonicalPath());
String path = "../../webapp/web";

View File

@ -48,9 +48,8 @@ public class TestArbitraryIndexDir extends AbstractSolrTestCase{
public void setUp() throws Exception {
super.setUp();
dataDir = new File(System.getProperty("java.io.tmpdir")
+ System.getProperty("file.separator")
+ getClass().getName() + "-" + System.currentTimeMillis() + System.getProperty("file.separator") + "solr"
dataDir = new File(TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis() + System.getProperty("file.separator") + "solr"
+ System.getProperty("file.separator") + "data");
dataDir.mkdirs();

View File

@ -652,18 +652,17 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
System.setProperty("solr.test.sys.prop1", "propone");
System.setProperty("solr.test.sys.prop2", "proptwo");
String home = System.getProperty("java.io.tmpdir")
+ File.separator
+ getClass().getName() + "-" + System.currentTimeMillis();
File home = new File(TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
if (null == masterPort) {
homeDir = new File(home + "master");
dataDir = new File(home + "master", "data");
confDir = new File(home + "master", "conf");
homeDir = new File(home, "master");
dataDir = new File(homeDir, "data");
confDir = new File(homeDir, "conf");
} else {
homeDir = new File(home + "slave");
dataDir = new File(home + "slave", "data");
confDir = new File(home + "slave", "conf");
homeDir = new File(home, "slave");
dataDir = new File(homeDir, "data");
confDir = new File(homeDir, "conf");
}
homeDir.mkdirs();

View File

@ -70,8 +70,7 @@ public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {
spellchecker.add(AbstractLuceneSpellChecker.LOCATION, spelling.getAbsolutePath());
spellchecker.add(IndexBasedSpellChecker.FIELD, "teststop");
spellchecker.add(FileBasedSpellChecker.SOURCE_FILE_CHAR_ENCODING, "UTF-8");
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File indexDir = new File(tmpDir, "spellingIdx" + new Date().getTime());
File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
indexDir.mkdirs();
spellchecker.add(FileBasedSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
SolrCore core = h.getCore();
@ -107,8 +106,7 @@ public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {
spellchecker.add(AbstractLuceneSpellChecker.LOCATION, spelling.getAbsolutePath());
spellchecker.add(IndexBasedSpellChecker.FIELD, "teststop");
spellchecker.add(FileBasedSpellChecker.SOURCE_FILE_CHAR_ENCODING, "UTF-8");
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File indexDir = new File(tmpDir, "spellingIdx" + new Date().getTime());
File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
indexDir.mkdirs();
spellchecker.add(FileBasedSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
spellchecker.add(FileBasedSpellChecker.FIELD_TYPE, "teststop");

View File

@ -82,8 +82,7 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
NamedList spellchecker = new NamedList();
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File indexDir = new File(tmpDir, "spellingIdx" + new Date().getTime());
File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
indexDir.mkdirs();
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
spellchecker.add(IndexBasedSpellChecker.FIELD, "title");
@ -157,8 +156,7 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
NamedList spellchecker = new NamedList();
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File indexDir = new File(tmpDir, "spellingIdx" + new Date().getTime());
File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
indexDir.mkdirs();
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
spellchecker.add(IndexBasedSpellChecker.FIELD, "title");
@ -213,8 +211,7 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
NamedList spellchecker = new NamedList();
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File indexDir = new File(tmpDir, "spellingIdx" + new Date().getTime());
File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
indexDir.mkdirs();
spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
spellchecker.add(IndexBasedSpellChecker.FIELD, "title");
@ -254,10 +251,9 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
NamedList spellchecker = new NamedList();
spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File indexDir = new File(tmpDir, "spellingIdx" + new Date().getTime());
File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
//create a standalone index
File altIndexDir = new File(tmpDir, "alternateIdx" + new Date().getTime());
File altIndexDir = new File(TEMP_DIR, "alternateIdx" + new Date().getTime());
IndexWriter iw = new IndexWriter(FSDirectory.open(altIndexDir), new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < ALT_DOCS.length; i++) {
Document doc = new Document();