You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2014/02/22 21:31:57 UTC
svn commit: r1570910 [4/4] - in /lucene/dev/branches/branch_4x: ./ solr/
solr/contrib/ solr/contrib/map-reduce/
solr/contrib/map-reduce/src/test-files/
solr/contrib/map-reduce/src/test-files/solr/
solr/contrib/map-reduce/src/test-files/test-documents/ ...
Modified: lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/stopwords.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/stopwords.txt?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/stopwords.txt (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/stopwords.txt Sat Feb 22 20:31:53 2014
@@ -12,47 +12,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
-#-----------------------------------------------------------------------
-# a couple of test stopwords to test that the words are really being
-# configured from this file:
-stopworda
-stopwordb
-
-#Standard english stop words taken from Lucene's StopAnalyzer
-a
-an
-and
-are
-as
-at
-be
-but
-by
-for
-if
-in
-into
-is
-it
-no
-not
-of
-on
-or
-s
-such
-t
-that
-the
-their
-then
-there
-these
-they
-this
-to
-was
-will
-with
-
Modified: lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/synonyms.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/synonyms.txt?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/synonyms.txt (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/synonyms.txt Sat Feb 22 20:31:53 2014
@@ -12,11 +12,9 @@
#-----------------------------------------------------------------------
#some test synonym mappings unlikely to appear in real input text
-aaa => aaaa
-bbb => bbbb1 bbbb2
-ccc => cccc1,cccc2
-a\=>a => b\=>b
-a\,a => b\,b
+aaafoo => aaabar
+bbbfoo => bbbfoo bbbbar
+cccfoo => cccbar cccbaz
fooaaa,baraaa,bazaaa
# Some synonym groups specific to this example
Modified: lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java Sat Feb 22 20:31:53 2014
@@ -37,7 +37,6 @@ import org.apache.solr.client.solrj.impl
import org.apache.solr.client.solrj.impl.XMLResponseParser;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
-import org.apache.solr.util.ExternalPaths;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -69,7 +68,7 @@ public class AbstractSolrMorphlineTestBa
protected static final String EXTERNAL_SOLR_SERVER_URL = System.getProperty("externalSolrServer");
// protected static final String EXTERNAL_SOLR_SERVER_URL = "http://127.0.0.1:8983/solr";
- protected static final String RESOURCES_DIR = ExternalPaths.SOURCE_HOME + "/contrib/map-reduce/src/test-files";
+ protected static final String RESOURCES_DIR = getFile("morphlines-core.marker").getParent();
protected static final String DEFAULT_BASE_DIR = "solr";
protected static final AtomicInteger SEQ_NUM = new AtomicInteger();
protected static final AtomicInteger SEQ_NUM2 = new AtomicInteger();
@@ -88,10 +87,9 @@ public class AbstractSolrMorphlineTestBa
protected static void myInitCore(String baseDirName) throws Exception {
Joiner joiner = Joiner.on(File.separator);
initCore(
- joiner.join(RESOURCES_DIR, baseDirName, "collection1", "conf", "solrconfig.xml"),
- joiner.join(RESOURCES_DIR, baseDirName, "collection1", "conf", "schema.xml"),
+ "solrconfig.xml", "schema.xml",
joiner.join(RESOURCES_DIR, baseDirName)
- );
+ );
}
@Before
@@ -288,9 +286,9 @@ public class AbstractSolrMorphlineTestBa
public static void setupMorphline(String tempDir, String file, boolean replaceSolrLocator) throws IOException {
String morphlineText = FileUtils.readFileToString(new File(RESOURCES_DIR + "/" + file + ".conf"), "UTF-8");
- morphlineText = morphlineText.replaceAll("RESOURCES_DIR", new File(tempDir).getAbsolutePath());
+ morphlineText = morphlineText.replace("RESOURCES_DIR", new File(tempDir).getAbsolutePath());
if (replaceSolrLocator) {
- morphlineText = morphlineText.replaceAll("\\$\\{SOLR_LOCATOR\\}",
+ morphlineText = morphlineText.replace("${SOLR_LOCATOR}",
"{ collection : collection1 }");
}
new File(tempDir + "/" + file + ".conf").getParentFile().mkdirs();
Modified: lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java Sat Feb 22 20:31:53 2014
@@ -28,7 +28,6 @@ import org.apache.solr.cloud.AbstractFul
import org.apache.solr.cloud.AbstractZkTestCase;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.cloud.SolrZkClient;
-import org.apache.solr.util.ExternalPaths;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -50,7 +49,7 @@ import com.typesafe.config.Config;
public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistribZkTestBase {
private static final File solrHomeDirectory = new File(TEMP_DIR, AbstractSolrMorphlineZkTestBase.class.getName());
- protected static final String RESOURCES_DIR = ExternalPaths.SOURCE_HOME + "/contrib/map-reduce/src/test-files";
+ 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_CONF_DIR = new File(RESOURCES_DIR + "/solr/collection1");
@@ -171,79 +170,32 @@ public abstract class AbstractSolrMorphl
return jetty;
}
- private static void putConfig(SolrZkClient zkClient, File solrhome, String name) throws Exception {
- putConfig(zkClient, solrhome, name, name);
+ private void putConfig(SolrZkClient zkClient, String name) throws Exception {
+ File file = new File(new File(SOLR_CONF_DIR, "conf"), name);
+ String destPath = "/configs/conf1/" + name;
+ System.out.println("put " + file.getAbsolutePath() + " to " + destPath);
+ zkClient.makePath(destPath, file, false, true);
}
- private static void putConfig(SolrZkClient zkClient, File solrhome, String srcName, String destName)
- throws Exception {
-
- File file = new File(solrhome, "conf" + File.separator + srcName);
- if (!file.exists()) {
- // LOG.info("skipping " + file.getAbsolutePath() +
- // " because it doesn't exist");
- return;
+ private void uploadConfFiles(SolrZkClient zkClient, File dir, String prefix) throws Exception {
+ boolean found = false;
+ for (File f : dir.listFiles()) {
+ String name = f.getName();
+ if (name.startsWith(".")) continue;
+ if (f.isFile()) {
+ putConfig(zkClient, prefix + name);
+ found = true;
+ } else if (f.isDirectory()) {
+ uploadConfFiles(zkClient, new File(dir, name), prefix + name + "/");
+ }
}
-
- String destPath = "/configs/conf1/" + destName;
- // LOG.info("put " + file.getAbsolutePath() + " to " + destPath);
- zkClient.makePath(destPath, file, false, true);
+ assertTrue("Config folder '" + dir + "' with files to upload to zookeeper was empty.", found);
}
private void uploadConfFiles() throws Exception {
// upload our own config files
SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(), 10000);
- putConfig(zkClient, SOLR_CONF_DIR, "solrconfig.xml");
- putConfig(zkClient, SOLR_CONF_DIR, "schema.xml");
- putConfig(zkClient, SOLR_CONF_DIR, "elevate.xml");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_en.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ar.txt");
-
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_bg.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ca.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_cz.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_da.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_el.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_es.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_eu.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_de.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fa.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fi.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fr.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ga.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_gl.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hi.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hu.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hy.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_id.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_it.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ja.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_lv.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_nl.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_no.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_pt.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ro.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ru.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_sv.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_th.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_tr.txt");
-
- putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_ca.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_fr.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_ga.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_it.txt");
-
- putConfig(zkClient, SOLR_CONF_DIR, "lang/stemdict_nl.txt");
-
- putConfig(zkClient, SOLR_CONF_DIR, "lang/hyphenations_ga.txt");
-
- putConfig(zkClient, SOLR_CONF_DIR, "stopwords.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "protwords.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "currency.xml");
- putConfig(zkClient, SOLR_CONF_DIR, "open-exchange-rates.json");
- putConfig(zkClient, SOLR_CONF_DIR, "mapping-ISOLatin1Accent.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "old_synonyms.txt");
- putConfig(zkClient, SOLR_CONF_DIR, "synonyms.txt");
+ uploadConfFiles(zkClient, new File(SOLR_CONF_DIR, "conf"), "");
zkClient.close();
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java Sat Feb 22 20:31:53 2014
@@ -83,7 +83,7 @@ public class ZkCLITest extends SolrTestC
} else {
File tmpSolrHome = new File(dataDir, "tmp-solr-home");
FileUtils.copyDirectory(new File(ExternalPaths.EXAMPLE_HOME), tmpSolrHome);
- FileUtils.copyFile(new File(ExternalPaths.SOURCE_HOME, "core/src/test-files/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();
}
Modified: lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java Sat Feb 22 20:31:53 2014
@@ -34,7 +34,6 @@ import org.apache.solr.common.SolrDocume
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
-import org.apache.solr.util.ExternalPaths;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -47,9 +46,7 @@ import org.junit.BeforeClass;
@Slow
public class CloudSolrServerTest extends AbstractFullDistribZkTestBase {
- private static final String SOLR_HOME = ExternalPaths.SOURCE_HOME + File.separator + "solrj"
- + File.separator + "src" + File.separator + "test-files"
- + File.separator + "solrj" + File.separator + "solr";
+ private static final String SOLR_HOME = getFile("solrj" + File.separator + "solr").getAbsolutePath();
@BeforeClass
public static void beforeSuperClass() {
Modified: lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java Sat Feb 22 20:31:53 2014
@@ -19,7 +19,7 @@ package org.apache.solr.client.solrj.req
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileInputStream;
+import java.io.InputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -34,7 +34,6 @@ import junit.framework.Assert;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
-import org.apache.solr.util.ExternalPaths;
import org.junit.Test;
/**
@@ -203,7 +202,8 @@ public class TestUpdateRequestCodec exte
- FileInputStream is = new FileInputStream(new File(ExternalPaths.SOURCE_HOME, "solrj/src/test-files/solrj/updateReq_4_5.bin"));
+ InputStream is = getClass().getResourceAsStream("/solrj/updateReq_4_5.bin");
+ assertNotNull("updateReq_4_5.bin was not found", is);
UpdateRequest updateUnmarshalled = new JavaBinUpdateRequestCodec().unmarshal(is, new JavaBinUpdateRequestCodec.StreamingUpdateHandler() {
@Override
public void update(SolrInputDocument document, UpdateRequest req, Integer commitWithin, Boolean override) {
Modified: lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java (original)
+++ lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java Sat Feb 22 20:31:53 2014
@@ -37,7 +37,7 @@ public class ExternalPaths {
* home, and if it is null, those paths will just be relative to 'null' and may not be
* meaningful.
*/
- public static final String SOURCE_HOME = determineSourceHome();
+ private static final String SOURCE_HOME = determineSourceHome();
/* @see #SOURCE_HOME */
public static String WEBAPP_HOME = new File(SOURCE_HOME, "webapp/web").getAbsolutePath();
/* @see #SOURCE_HOME */
Modified: lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java?rev=1570910&r1=1570909&r2=1570910&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java (original)
+++ lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java Sat Feb 22 20:31:53 2014
@@ -38,8 +38,8 @@ import org.apache.solr.common.params.Sol
import org.eclipse.jetty.util.security.CertificateUtils;
public class SSLTestConfig extends SSLConfig {
- public static File TEST_KEYSTORE = ExternalPaths.SOURCE_HOME == null ? null
- : new File(ExternalPaths.SOURCE_HOME, "example/etc/solrtest.keystore");
+ public static File TEST_KEYSTORE = ExternalPaths.EXAMPLE_HOME == null ? null
+ : new File(ExternalPaths.EXAMPLE_HOME, "../etc/solrtest.keystore");
private static String TEST_KEYSTORE_PATH = TEST_KEYSTORE != null
&& TEST_KEYSTORE.exists() ? TEST_KEYSTORE.getAbsolutePath() : null;