本文整理汇总了Java中org.apache.solr.SolrTestCaseJ4.TEST_HOME属性的典型用法代码示例。如果您正苦于以下问题:Java SolrTestCaseJ4.TEST_HOME属性的具体用法?Java SolrTestCaseJ4.TEST_HOME怎么用?Java SolrTestCaseJ4.TEST_HOME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.solr.SolrTestCaseJ4
的用法示例。
在下文中一共展示了SolrTestCaseJ4.TEST_HOME属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPropertySub
public void testPropertySub() throws IOException {
System.setProperty("coreRootDirectory", "myCoreRoot" + File.separator);
System.setProperty("hostPort", "8888");
System.setProperty("shareSchema", "false");
System.setProperty("socketTimeout", "220");
System.setProperty("connTimeout", "200");
File testSrcRoot = new File(SolrTestCaseJ4.TEST_HOME());
FileUtils.copyFile(new File(testSrcRoot, "solr-50-all.xml"), new File(solrHome, "solr.xml"));
ConfigSolr cfg = ConfigSolr.fromSolrHome(loader, solrHome.getAbsolutePath());
assertEquals("core root dir", "myCoreRoot" + File.separator, cfg.getCoreRootDirectory());
assertEquals("zk host port", "8888", cfg.getZkHostPort());
assertEquals("schema cache", false, cfg.hasSchemaCache());
}
示例2: makeCores
private void makeCores(File home, boolean oldStyle) throws Exception {
File testSrcRoot = new File(SolrTestCaseJ4.TEST_HOME());
String srcSolrXml = "solr-stress-new.xml";
if (oldStyle) {
srcSolrXml = "solr-stress-old.xml";
}
FileUtils.copyFile(new File(testSrcRoot, srcSolrXml), new File(home, "solr.xml"));
// create directories in groups of 100 until you have enough.
for (int idx = 0; idx < numCores; ++idx) {
String coreName = String.format(Locale.ROOT, "%05d_core", idx);
makeCore(new File(home, coreName), testSrcRoot, coreName);
coreCounts.put(coreName, 0L);
coreNames.add(coreName);
}
}
示例3: beforeTest
@BeforeClass
public static void beforeTest() throws Exception {
solrHomeDirectory = createTempDir();
setupJettyTestHome(solrHomeDirectory, "collection1");
String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
FileUtils.copyFile(new File(top, "solrconfig-headers.xml"), new File(solrHomeDirectory + "/collection1/conf", "solrconfig.xml"));
createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
}
示例4: setupCore
private static void setupCore(String coreName, boolean blivet) throws IOException {
File instDir = new File(solrHomeDirectory, coreName);
File subHome = new File(instDir, "conf");
assertTrue("Failed to make subdirectory ", subHome.mkdirs());
// Be sure we pick up sysvars when we create this
String srcDir = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
FileUtils.copyFile(new File(srcDir, "schema-tiny.xml"), new File(subHome, "schema_ren.xml"));
FileUtils.copyFile(new File(srcDir, "solrconfig-minimal.xml"), new File(subHome, "solrconfig_ren.xml"));
FileUtils.copyFile(new File(srcDir, "solrconfig.snippet.randomindexconfig.xml"),
new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
}
示例5: testAllInfoPresent
public void testAllInfoPresent() throws IOException {
File testSrcRoot = new File(SolrTestCaseJ4.TEST_HOME());
FileUtils.copyFile(new File(testSrcRoot, "solr-50-all.xml"), new File(solrHome, "solr.xml"));
ConfigSolr cfg = ConfigSolr.fromSolrHome(loader, solrHome.getAbsolutePath());
assertEquals("core admin handler class", "testAdminHandler", cfg.getCoreAdminHandlerClass());
assertEquals("collection handler class", "testCollectionsHandler", cfg.getCollectionsHandlerClass());
assertEquals("info handler class", "testInfoHandler", cfg.getInfoHandlerClass());
assertEquals("core load threads", 11, cfg.getCoreLoadThreadCount());
assertEquals("core root dir", "testCoreRootDirectory" + File.separator, cfg.getCoreRootDirectory());
assertEquals("distrib conn timeout", 22, cfg.getDistributedConnectionTimeout());
assertEquals("distrib socket timeout", 33, cfg.getDistributedSocketTimeout());
assertEquals("max update conn", 3, cfg.getMaxUpdateConnections());
assertEquals("max update conn/host", 37, cfg.getMaxUpdateConnectionsPerHost());
assertEquals("host", "testHost", cfg.getHost());
assertEquals("zk host context", "testHostContext", cfg.getZkHostContext());
assertEquals("zk host port", "44", cfg.getZkHostPort());
assertEquals("leader vote wait", 55, cfg.getLeaderVoteWait());
assertEquals("logging class", "testLoggingClass", cfg.getLogWatcherConfig().getLoggingClass());
assertEquals("log watcher", true, cfg.getLogWatcherConfig().isEnabled());
assertEquals("log watcher size", 88, cfg.getLogWatcherConfig().getWatcherSize());
assertEquals("log watcher thresh", "99", cfg.getLogWatcherConfig().getWatcherThreshold());
assertEquals("manage path", "testManagementPath", cfg.getManagementPath());
assertEquals("shardLib", "testSharedLib", cfg.getSharedLibDirectory());
assertEquals("schema cache", true, cfg.hasSchemaCache());
assertEquals("trans cache size", 66, cfg.getTransientCacheSize());
assertEquals("zk client timeout", 77, cfg.getZkClientTimeout());
assertEquals("zk host", "testZkHost", cfg.getZkHost());
assertEquals("persistent", true, cfg.isPersistent());
assertEquals("core admin path", ConfigSolr.DEFAULT_CORE_ADMIN_PATH, cfg.getAdminPath());
}
示例6: copyGoodConf
private void copyGoodConf(String coreName, String srcName, String dstName) throws IOException {
File coreRoot = new File(solrHomeDirectory, coreName);
File subHome = new File(coreRoot, "conf");
String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
FileUtils.copyFile(new File(top, srcName), new File(subHome, dstName));
}
示例7: addConfFiles
private void addConfFiles(File confDir) throws Exception {
String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
assertTrue("Failed to mkdirs for " + confDir.getAbsolutePath(), confDir.mkdirs());
FileUtils.copyFile(new File(top, "schema-tiny.xml"), new File(confDir, "schema-tiny.xml"));
FileUtils.copyFile(new File(top, "solrconfig-minimal.xml"), new File(confDir, "solrconfig-minimal.xml"));
FileUtils.copyFile(new File(top, "solrconfig.snippet.randomindexconfig.xml"), new File(confDir, "solrconfig.snippet.randomindexconfig.xml"));
}
示例8: copyConfFiles
private void copyConfFiles(File home, String subdir) throws IOException {
File subHome = new File(new File(home, subdir), "conf");
assertTrue("Failed to make subdirectory ", subHome.mkdirs());
String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
for (String file : _necessaryConfs) {
FileUtils.copyFile(new File(top, file), new File(subHome, file));
}
}
示例9: setUpBeforeClass
@BeforeClass
public static void setUpBeforeClass() throws Exception{
// Set up a MiniSolrCloudCluster
String testHome = SolrTestCaseJ4.TEST_HOME();
miniCluster = new MiniSolrCloudCluster(1, null, new File(testHome, "solr-no-core.xml"),null, null);
assertNotNull(miniCluster.getZkServer());
miniCluster.getZkServer().setTheTickTime(5000);
assertNotNull(miniCluster.getZkServer());
// create collection
System.setProperty("solr.tests.mergePolicy", "org.apache.lucene.index.TieredMergePolicy");
uploadConfigToZk(SolrTestCaseJ4.TEST_HOME() + File.separator + "collection1" + File.separator + "conf", CONFIG_NAME);
createCollection(COLLECTION_NAME, NUM_SHARDS, REPLICATION_FACTOR, CONFIG_NAME);
//insert documents into the collection
insertDocs();
// Set up the HIVE directory structure
FileUtils.forceMkdir(HIVE_BASE_DIR);
FileUtils.forceMkdir(HIVE_SCRATCH_DIR);
FileUtils.forceMkdir(HIVE_LOCAL_SCRATCH_DIR);
FileUtils.forceMkdir(HIVE_LOGS_DIR);
FileUtils.forceMkdir(HIVE_TMP_DIR);
FileUtils.forceMkdir(HIVE_WAREHOUSE_DIR);
FileUtils.forceMkdir(HIVE_HADOOP_TMP_DIR);
FileUtils.forceMkdir(HIVE_TESTDATA_DIR);
// Set up the HIVE property in the environment
System.setProperty("tickTime", "5000");
System.setProperty("hive.metastore.warehouse.dir", HIVE_WAREHOUSE_DIR.getAbsolutePath());
System.setProperty("hive.exec.scratchdir", HIVE_SCRATCH_DIR.getAbsolutePath());
System.setProperty("hive.exec.local.scratchdir", HIVE_LOCAL_SCRATCH_DIR.getAbsolutePath());
System.setProperty("hive.metastore.metadb.dir", HIVE_METADB_DIR.getAbsolutePath());
System.setProperty("test.log.dir", HIVE_LOGS_DIR.getAbsolutePath());
System.setProperty("hive.querylog.location", HIVE_TMP_DIR.getAbsolutePath());
System.setProperty("hadoop.tmp.dir", HIVE_HADOOP_TMP_DIR.getAbsolutePath());
System.setProperty("derby.stream.error.file",HIVE_BASE_DIR.getAbsolutePath() + "/derby.log");
}
示例10: testCreateWithSysVars
@Test
public void testCreateWithSysVars() throws Exception {
useFactory(null); // I require FS-based indexes for this test.
final File workDir = createTempDir(getCoreName());
String coreName = "with_sys_vars";
File instDir = new File(workDir, coreName);
File subHome = new File(instDir, "conf");
assertTrue("Failed to make subdirectory ", subHome.mkdirs());
// Be sure we pick up sysvars when we create this
String srcDir = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
FileUtils.copyFile(new File(srcDir, "schema-tiny.xml"), new File(subHome, "schema_ren.xml"));
FileUtils.copyFile(new File(srcDir, "solrconfig-minimal.xml"), new File(subHome, "solrconfig_ren.xml"));
FileUtils.copyFile(new File(srcDir, "solrconfig.snippet.randomindexconfig.xml"),
new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
final CoreContainer cores = h.getCoreContainer();
SolrXMLCoresLocator.NonPersistingLocator locator
= (SolrXMLCoresLocator.NonPersistingLocator) cores.getCoresLocator();
final CoreAdminHandler admin = new CoreAdminHandler(cores);
// create a new core (using CoreAdminHandler) w/ properties
System.setProperty("INSTDIR_TEST", instDir.getAbsolutePath());
System.setProperty("CONFIG_TEST", "solrconfig_ren.xml");
System.setProperty("SCHEMA_TEST", "schema_ren.xml");
File dataDir = new File(workDir.getAbsolutePath(), "data_diff");
System.setProperty("DATA_TEST", dataDir.getAbsolutePath());
SolrQueryResponse resp = new SolrQueryResponse();
admin.handleRequestBody
(req(CoreAdminParams.ACTION,
CoreAdminParams.CoreAdminAction.CREATE.toString(),
CoreAdminParams.NAME, getCoreName(),
CoreAdminParams.INSTANCE_DIR, "${INSTDIR_TEST}",
CoreAdminParams.CONFIG, "${CONFIG_TEST}",
CoreAdminParams.SCHEMA, "${SCHEMA_TEST}",
CoreAdminParams.DATA_DIR, "${DATA_TEST}"),
resp);
assertNull("Exception on create", resp.getException());
// First assert that these values are persisted.
h.validateXPath
(locator.xml
,"/solr/cores/core[@name='" + getCoreName() + "' and @instanceDir='${INSTDIR_TEST}']"
,"/solr/cores/core[@name='" + getCoreName() + "' and @dataDir='${DATA_TEST}']"
,"/solr/cores/core[@name='" + getCoreName() + "' and @schema='${SCHEMA_TEST}']"
,"/solr/cores/core[@name='" + getCoreName() + "' and @config='${CONFIG_TEST}']"
);
// Now assert that certain values are properly dereferenced in the process of creating the core, see
// SOLR-4982.
// Should NOT be a datadir named ${DATA_TEST} (literal). This is the bug after all
File badDir = new File(instDir, "${DATA_TEST}");
assertFalse("Should have substituted the sys var, found file " + badDir.getAbsolutePath(), badDir.exists());
// For the other 3 vars, we couldn't get past creating the core fi dereferencing didn't work correctly.
// Should have segments in the directory pointed to by the ${DATA_TEST}.
File test = new File(dataDir, "index");
assertTrue("Should have found index dir at " + test.getAbsolutePath(), test.exists());
test = new File(test,"segments.gen");
assertTrue("Should have found segments.gen at " + test.getAbsolutePath(), test.exists());
}
示例11: startup
@BeforeClass
public static void startup() throws Exception {
String testHome = SolrTestCaseJ4.TEST_HOME();
miniCluster = new MiniSolrCloudCluster(NUM_SERVERS, null, new File(testHome, "solr-no-core.xml"),
null, null);
}
示例12: getSolrHome
/**
* Subclasses can override this to change a test's solr home
* (default is in test-files)
*/
public String getSolrHome() {
return SolrTestCaseJ4.TEST_HOME();
}