SOLR-4124: change copyDirectory call to apache util

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1420248 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-12-11 16:17:45 +00:00
parent 932300fd3b
commit 0b7e234a69
1 changed files with 17 additions and 4 deletions

View File

@ -19,14 +19,14 @@ package org.apache.solr.client.solrj.request;
import java.io.File; import java.io.File;
import org.apache.derby.iapi.services.io.FileUtil;
import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter;
import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.embedded.AbstractEmbeddedSolrServerTestCase; import org.apache.solr.client.solrj.embedded.AbstractEmbeddedSolrServerTestCase;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.core.SolrCore; import org.apache.solr.core.SolrCore;
import org.apache.solr.util.FileUtils; import org.apache.commons.io.FileUtils;
import org.junit.After; import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -39,6 +39,8 @@ public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {
private static final String SOLR_XML = "solr.xml"; private static final String SOLR_XML = "solr.xml";
private static String tempDirProp;
@Override @Override
protected File getSolrXml() throws Exception { protected File getSolrXml() throws Exception {
// This test writes on the directory where the solr.xml is located. Better // This test writes on the directory where the solr.xml is located. Better
@ -70,7 +72,7 @@ public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {
+ System.currentTimeMillis() + "-" + "instance"); + System.currentTimeMillis() + "-" + "instance");
File instanceDir = new File(cores.getSolrHome()); File instanceDir = new File(cores.getSolrHome());
FileUtil.copyDirectory(instanceDir, new File(newCoreInstanceDir, FileUtils.copyDirectory(instanceDir, new File(newCoreInstanceDir,
"newcore")); "newcore"));
CoreAdminRequest.Create req = new CoreAdminRequest.Create(); CoreAdminRequest.Create req = new CoreAdminRequest.Create();
@ -92,10 +94,21 @@ public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {
} }
@BeforeClass
public static void before() {
// wtf?
if (System.getProperty("tempDir") != null)
tempDirProp = System.getProperty("tempDir");
}
@After @After
public void after() { public void after() {
// wtf? // wtf?
System.setProperty("tempDir", "."); if (tempDirProp != null) {
System.setProperty("tempDir", tempDirProp);
} else {
System.clearProperty("tempDir");
}
System.clearProperty("solr.solr.home"); System.clearProperty("solr.solr.home");
} }