You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2015/02/25 15:45:51 UTC

svn commit: r1662232 [2/2] - in /lucene/dev/trunk/solr: core/src/java/org/apache/solr/cloud/ core/src/java/org/apache/solr/core/ core/src/java/org/apache/solr/handler/component/ core/src/java/org/apache/solr/servlet/ core/src/java/org/apache/solr/updat...

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java Wed Feb 25 14:45:51 2015
@@ -23,14 +23,13 @@ import org.apache.solr.common.cloud.Solr
 import org.apache.solr.common.cloud.ZkConfigManager;
 import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.core.ConfigSolr;
+import org.apache.solr.core.CloudConfig;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.CoreDescriptor;
-import org.apache.solr.core.CoresLocator;
-import org.apache.solr.core.PluginInfo;
 import org.apache.solr.handler.admin.CoreAdminHandler;
 import org.apache.solr.handler.component.HttpShardHandlerFactory;
 import org.apache.solr.update.UpdateShardHandler;
+import org.apache.solr.update.UpdateShardHandlerConfig;
 import org.apache.zookeeper.CreateMode;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -181,9 +180,10 @@ public class ZkControllerTest extends So
       zkClient.close();
       
       cc = getCoreContainer();
-      
-      ZkController zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, 10000,
-          "127.0.0.1", "8983", "solr", 0, 60000, true, new CurrentCoreDescriptorProvider() {
+
+      CloudConfig cloudConfig = new CloudConfig.CloudConfigBuilder("127.0.0.1", 8983, "solr").build();
+      ZkController zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, cloudConfig,
+          new CurrentCoreDescriptorProvider() {
             
             @Override
             public List<CoreDescriptor> getCurrentDescriptors() {
@@ -206,7 +206,6 @@ public class ZkControllerTest extends So
 
   }
 
-  @Test
   public void testGetHostName() throws Exception {
     String zkDir = createTempDir("zkData").toFile().getAbsolutePath();
     CoreContainer cc = null;
@@ -222,8 +221,8 @@ public class ZkControllerTest extends So
       ZkController zkController = null;
 
       try {
-        zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, 10000,
-            "http://127.0.0.1", "8983", "solr", 0, 60000, true, new CurrentCoreDescriptorProvider() {
+        CloudConfig cloudConfig = new CloudConfig.CloudConfigBuilder("127.0.0.1", 8983, "solr").build();
+        zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, cloudConfig, new CurrentCoreDescriptorProvider() {
 
           @Override
           public List<CoreDescriptor> getCurrentDescriptors() {
@@ -263,33 +262,11 @@ public class ZkControllerTest extends So
     }
     
     @Override
-    public void load() {};
-    
-    @Override
-    public ConfigSolr getConfig() {
-      return new ConfigSolr(null, null) {
-
-        @Override
-        public CoresLocator getCoresLocator() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public PluginInfo getShardHandlerFactoryPluginInfo() {
-          return null;
-        }
-
-        @Override
-        protected String getProperty(CfgProp key) {
-          return null;
-        }
-
-      };
-    }
+    public void load() {}
     
     @Override
     public UpdateShardHandler getUpdateShardHandler() {
-      return new UpdateShardHandler(null);
+      return new UpdateShardHandler(UpdateShardHandlerConfig.DEFAULT);
     }
 
   }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestConfigSets.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestConfigSets.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestConfigSets.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestConfigSets.java Wed Feb 25 14:45:51 2015
@@ -46,7 +46,7 @@ public class TestConfigSets extends Solr
     System.setProperty("configsets", configSetsBaseDir);
 
     SolrResourceLoader loader = new SolrResourceLoader(testDirectory.getAbsolutePath());
-    CoreContainer container = new CoreContainer(ConfigSolr.fromString(loader, solrxml));
+    CoreContainer container = new CoreContainer(SolrXmlConfig.fromString(loader, solrxml));
     container.load();
 
     return container;
@@ -115,7 +115,7 @@ public class TestConfigSets extends Solr
     System.setProperty("configsets", csd);
 
     SolrResourceLoader loader = new SolrResourceLoader(testDirectory.getAbsolutePath());
-    CoreContainer container = new CoreContainer(ConfigSolr.fromString(loader, solrxml));
+    CoreContainer container = new CoreContainer(SolrXmlConfig.fromString(loader, solrxml));
     container.load();
 
     // We initially don't have a /get handler defined

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java Wed Feb 25 14:45:51 2015
@@ -74,7 +74,7 @@ public class TestCoreContainer extends S
 
   private CoreContainer init(Path homeDirectory, String xml) throws Exception {
     SolrResourceLoader loader = new SolrResourceLoader(homeDirectory.toString());
-    CoreContainer ret = new CoreContainer(ConfigSolr.fromString(loader, xml));
+    CoreContainer ret = new CoreContainer(SolrXmlConfig.fromString(loader, xml));
     ret.load();
     return ret;
   }
@@ -203,7 +203,7 @@ public class TestCoreContainer extends S
 
     System.setProperty("configsets", getFile("solr/configsets").getAbsolutePath());
 
-    final CoreContainer cc = new CoreContainer(ConfigSolr.fromString(resourceLoader, CONFIGSETS_SOLR_XML), cl);
+    final CoreContainer cc = new CoreContainer(SolrXmlConfig.fromString(resourceLoader, CONFIGSETS_SOLR_XML), cl);
     CoreDescriptor badcore = new CoreDescriptor(cc, "badcore", "badcore", "configSet", "nosuchconfigset");
     cl.add(badcore);
 
@@ -452,7 +452,7 @@ public class TestCoreContainer extends S
 
     System.setProperty("configsets", getFile("solr/configsets").getAbsolutePath());
 
-    final CoreContainer cc = new CoreContainer(ConfigSolr.fromString(resourceLoader, CONFIGSETS_SOLR_XML), cl);
+    final CoreContainer cc = new CoreContainer(SolrXmlConfig.fromString(resourceLoader, CONFIGSETS_SOLR_XML), cl);
     cl.add(new CoreDescriptor(cc, "col_ok", "col_ok", "configSet", "minimal"));
     cl.add(new CoreDescriptor(cc, "col_bad", "col_bad", "configSet", "bad-mergepolicy"));
     cc.load();

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java Wed Feb 25 14:45:51 2015
@@ -52,7 +52,7 @@ public class TestCoreDiscovery extends S
     if (alternateCoreDir != null) {
       xmlStr = xmlStr.replace("<solr>", "<solr> <str name=\"coreRootDirectory\">" + alternateCoreDir + "</str> ");
     }
-    File tmpFile = new File(solrHomeDirectory, ConfigSolr.SOLR_XML_FILE);
+    File tmpFile = new File(solrHomeDirectory, SolrXmlConfig.SOLR_XML_FILE);
     FileUtils.write(tmpFile, xmlStr, IOUtils.UTF_8);
 
   }
@@ -400,10 +400,10 @@ public class TestCoreDiscovery extends S
 
     SolrResourceLoader loader = new SolrResourceLoader(solrHomeDirectory.getAbsolutePath());
 
-    ConfigSolr config = ConfigSolr.fromString(loader, "<solr><str name=\"coreRootDirectory\">relative</str></solr>");
+    NodeConfig config = SolrXmlConfig.fromString(loader, "<solr><str name=\"coreRootDirectory\">relative</str></solr>");
     assertThat(config.getCoreRootDirectory(), containsString(solrHomeDirectory.getAbsolutePath()));
 
-    ConfigSolr absConfig = ConfigSolr.fromString(loader, "<solr><str name=\"coreRootDirectory\">/absolute</str></solr>");
+    NodeConfig absConfig = SolrXmlConfig.fromString(loader, "<solr><str name=\"coreRootDirectory\">/absolute</str></solr>");
     assertThat(absConfig.getCoreRootDirectory(), not(containsString(solrHomeDirectory.getAbsolutePath())));
   }
 }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestLazyCores.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestLazyCores.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestLazyCores.java Wed Feb 25 14:45:51 2015
@@ -49,6 +49,30 @@ public class TestLazyCores extends SolrT
 
   private File solrHomeDirectory;
 
+  private static CoreDescriptor makeCoreDescriptor(CoreContainer cc, String coreName, String instanceDir, String isTransient, String loadOnStartup) {
+    return new CoreDescriptor(cc, coreName, instanceDir,
+        CoreDescriptor.CORE_TRANSIENT, isTransient,
+        CoreDescriptor.CORE_LOADONSTARTUP, loadOnStartup);
+  }
+
+  private static CoresLocator testCores = new ReadOnlyCoresLocator() {
+    @Override
+    public List<CoreDescriptor> discover(CoreContainer cc) {
+      return ImmutableList.of(
+          new CoreDescriptor(cc, "collection1", "collection1"),
+          makeCoreDescriptor(cc, "collectionLazy2", "collection2", "true", "true"),
+          makeCoreDescriptor(cc, "collectionLazy3", "collection3", "on", "false"),
+          makeCoreDescriptor(cc, "collectionLazy4", "collection4", "false", "false"),
+          makeCoreDescriptor(cc, "collectionLazy5", "collection5", "false", "true"),
+          makeCoreDescriptor(cc, "collectionLazy6", "collection6", "true", "false"),
+          makeCoreDescriptor(cc, "collectionLazy7", "collection7", "true", "false"),
+          makeCoreDescriptor(cc, "collectionLazy8", "collection8", "true", "false"),
+          makeCoreDescriptor(cc, "collectionLazy9", "collection9", "true", "false")
+      );
+    }
+  };
+
+
   private CoreContainer init() throws Exception {
     solrHomeDirectory = createTempDir().toFile();
     
@@ -57,7 +81,8 @@ public class TestLazyCores extends SolrT
     }
 
     SolrResourceLoader loader = new SolrResourceLoader(solrHomeDirectory.getAbsolutePath());
-    return createCoreContainer(new LazyCoreTestConfig(loader));
+    NodeConfig config = new NodeConfig.NodeConfigBuilder("testNode", loader).setTransientCacheSize(4).build();
+    return createCoreContainer(config, testCores);
   }
   
   @Test
@@ -539,10 +564,10 @@ public class TestLazyCores extends SolrT
     FileUtils.write(solrXml, "<solr/>", Charsets.UTF_8.toString());
 
     SolrResourceLoader loader = new SolrResourceLoader(solrHomeDirectory.getAbsolutePath());
-    ConfigSolrXml config = (ConfigSolrXml) ConfigSolr.fromFile(loader, solrXml);
+    NodeConfig config = SolrXmlConfig.fromFile(loader, solrXml);
 
     // OK this should succeed, but at the end we should have recorded a series of errors.
-    return createCoreContainer(config);
+    return createCoreContainer(config, new CorePropertiesLocator(config.getCoreRootDirectory()));
   }
 
   // We want to see that the core "heals itself" if an un-corrupted file is written to the directory.
@@ -619,51 +644,4 @@ public class TestLazyCores extends SolrT
     return StringUtils.join(args, File.separator);
   }
 
-  public static class LazyCoreTestConfig extends ConfigSolr {
-
-    public LazyCoreTestConfig(SolrResourceLoader loader) {
-      super(loader, null);
-    }
-
-    static CoreDescriptor makeCoreDescriptor(CoreContainer cc, String coreName, String instanceDir, String isTransient, String loadOnStartup) {
-      return new CoreDescriptor(cc, coreName, instanceDir,
-          CoreDescriptor.CORE_TRANSIENT, isTransient,
-          CoreDescriptor.CORE_LOADONSTARTUP, loadOnStartup);
-    }
-
-    @Override
-    public CoresLocator getCoresLocator() {
-      return new ReadOnlyCoresLocator() {
-        @Override
-        public List<CoreDescriptor> discover(CoreContainer cc) {
-          return ImmutableList.of(
-              new CoreDescriptor(cc, "collection1", "collection1"),
-              makeCoreDescriptor(cc, "collectionLazy2", "collection2", "true", "true"),
-              makeCoreDescriptor(cc, "collectionLazy3", "collection3", "on", "false"),
-              makeCoreDescriptor(cc, "collectionLazy4", "collection4", "false", "false"),
-              makeCoreDescriptor(cc, "collectionLazy5", "collection5", "false", "true"),
-              makeCoreDescriptor(cc, "collectionLazy6", "collection6", "true", "false"),
-              makeCoreDescriptor(cc, "collectionLazy7", "collection7", "true", "false"),
-              makeCoreDescriptor(cc, "collectionLazy8", "collection8", "true", "false"),
-              makeCoreDescriptor(cc, "collectionLazy9", "collection9", "true", "false")
-          );
-        }
-      };
-    }
-
-    @Override
-    public PluginInfo getShardHandlerFactoryPluginInfo() {
-      return null;
-    }
-
-    @Override
-    protected String getProperty(CfgProp key) {
-      switch (key) {
-        case SOLR_TRANSIENTCACHESIZE:
-          return "4";
-      }
-      return null;
-    }
-  }
-
 }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrXml.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrXml.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrXml.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestSolrXml.java Wed Feb 25 14:45:51 2015
@@ -22,8 +22,10 @@ import org.apache.commons.io.FileUtils;
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.update.UpdateShardHandlerConfig;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.rules.ExpectedException;
 import org.junit.rules.RuleChain;
@@ -63,7 +65,9 @@ public class TestSolrXml extends SolrTes
     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());
+    NodeConfig cfg = SolrXmlConfig.fromSolrHome(loader, solrHome.getAbsolutePath());
+    CloudConfig ccfg = cfg.getCloudConfig();
+    UpdateShardHandlerConfig ucfg = cfg.getUpdateShardHandlerConfig();
     
     assertEquals("core admin handler class", "testAdminHandler", cfg.getCoreAdminHandlerClass());
     assertEquals("collection handler class", "testCollectionsHandler", cfg.getCollectionsHandlerClass());
@@ -71,13 +75,21 @@ public class TestSolrXml extends SolrTes
     assertEquals("core load threads", 11, cfg.getCoreLoadThreadCount());
     assertThat("core root dir", cfg.getCoreRootDirectory(), containsString("testCoreRootDirectory"));
     assertEquals("distrib conn timeout", 22, cfg.getDistributedConnectionTimeout());
+    assertEquals("distrib conn timeout", 22, cfg.getUpdateShardHandlerConfig().getDistributedConnectionTimeout());
     assertEquals("distrib socket timeout", 33, cfg.getDistributedSocketTimeout());
+    assertEquals("distrib socket timeout", 33, cfg.getUpdateShardHandlerConfig().getDistributedSocketTimeout());
     assertEquals("max update conn", 3, cfg.getMaxUpdateConnections());
+    assertEquals("max update conn", 3, cfg.getUpdateShardHandlerConfig().getMaxUpdateConnections());
     assertEquals("max update conn/host", 37, cfg.getMaxUpdateConnectionsPerHost());
-    assertEquals("host", "testHost", cfg.getHost());
-    assertEquals("zk host context", "testHostContext", cfg.getZkHostContext());
-    assertEquals("solr host port", "44", cfg.getSolrHostPort());
-    assertEquals("leader vote wait", 55, cfg.getLeaderVoteWait());
+    assertEquals("max update conn/host", 37, cfg.getUpdateShardHandlerConfig().getMaxUpdateConnectionsPerHost());
+    assertEquals("distrib conn timeout", 22, ucfg.getDistributedConnectionTimeout());
+    assertEquals("distrib socket timeout", 33, ucfg.getDistributedSocketTimeout());
+    assertEquals("max update conn", 3, ucfg.getMaxUpdateConnections());
+    assertEquals("max update conn/host", 37, ucfg.getMaxUpdateConnectionsPerHost());
+    assertEquals("host", "testHost", ccfg.getHost());
+    assertEquals("zk host context", "testHostContext", ccfg.getSolrHostContext());
+    assertEquals("solr host port", 44, ccfg.getSolrHostPort());
+    assertEquals("leader vote wait", 55, ccfg.getLeaderVoteWait());
     assertEquals("logging class", "testLoggingClass", cfg.getLogWatcherConfig().getLoggingClass());
     assertEquals("log watcher", true, cfg.getLogWatcherConfig().isEnabled());
     assertEquals("log watcher size", 88, cfg.getLogWatcherConfig().getWatcherSize());
@@ -86,8 +98,8 @@ public class TestSolrXml extends SolrTes
     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("zk client timeout", 77, ccfg.getZkClientTimeout());
+    assertEquals("zk host", "testZkHost", ccfg.getZkHost());
   }
 
   // Test  a few property substitutions that happen to be in solr-50-all.xml.
@@ -102,19 +114,23 @@ public class TestSolrXml extends SolrTes
     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());
+    NodeConfig cfg = SolrXmlConfig.fromSolrHome(loader, solrHome.getAbsolutePath());
     assertThat(cfg.getCoreRootDirectory(), containsString("myCoreRoot"));
-    assertEquals("solr host port", "8888", cfg.getSolrHostPort());
+    assertEquals("solr host port", 8888, cfg.getCloudConfig().getSolrHostPort());
     assertEquals("schema cache", false, cfg.hasSchemaCache());
   }
 
   public void testExplicitNullGivesDefaults() throws IOException {
-    // 2 diff options, one where the default is in fact null, and one where it isn't
-    String solrXml = "<solr><solrcloud><null name=\"host\"/><null name=\"leaderVoteWait\"/></solrcloud></solr>";
+    String solrXml = "<solr>" +
+        "<solrcloud>" +
+        "<str name=\"host\">host</str>" +
+        "<int name=\"hostPort\">8983</int>" +
+        "<str name=\"hostContext\">solr</str>" +
+        "<null name=\"leaderVoteWait\"/>" +
+        "</solrcloud></solr>";
 
-    ConfigSolr cfg = ConfigSolr.fromString(loader, solrXml);
-    assertEquals("host", null, cfg.getHost());
-    assertEquals("leaderVoteWait", 180000, cfg.getLeaderVoteWait());
+    NodeConfig cfg = SolrXmlConfig.fromString(loader, solrXml);
+    assertEquals("leaderVoteWait", 180000, cfg.getCloudConfig().getLeaderVoteWait());
   }
 
   public void testIntAsLongBad() throws IOException {
@@ -122,14 +138,14 @@ public class TestSolrXml extends SolrTes
     String solrXml = "<solr><long name=\"transientCacheSize\">"+bad+"</long></solr>";
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage(String.format(Locale.ROOT, "Value of '%s' can not be parsed as 'int'", bad));
-    ConfigSolr cfg = ConfigSolr.fromString(loader, solrXml);
+    expectedException.expectMessage("transientCacheSize");
+    NodeConfig cfg = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testIntAsLongOk() throws IOException {
     int ok = random().nextInt();
     String solrXml = "<solr><long name=\"transientCacheSize\">"+ok+"</long></solr>";
-    ConfigSolr cfg = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig cfg = SolrXmlConfig.fromString(loader, solrXml);
     assertEquals(ok, cfg.getTransientCacheSize());
   }
 
@@ -139,8 +155,8 @@ public class TestSolrXml extends SolrTes
       + "<solrcloud><bool name=\"genericCoreNodeNames\">false</bool></solrcloud>"
       + "</solr>";
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage("2 instances of <solrcloud> found in solr.xml");
-    ConfigSolr cfg = ConfigSolr.fromString(loader, solrXml);
+    expectedException.expectMessage("Multiple instances of solrcloud section found in solr.xml");
+    NodeConfig cfg = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testMultiLoggingSectionError() throws IOException {
@@ -149,8 +165,8 @@ public class TestSolrXml extends SolrTes
       + "<logging><str name=\"class\">foo</str></logging>"
       + "</solr>";
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage("2 instances of <logging> found in solr.xml");
-    ConfigSolr cfg = ConfigSolr.fromString(loader, solrXml);
+    expectedException.expectMessage("Multiple instances of logging section found in solr.xml");
+    NodeConfig cfg = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testMultiLoggingWatcherSectionError() throws IOException {
@@ -161,23 +177,23 @@ public class TestSolrXml extends SolrTes
       + "</logging></solr>";
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage("3 instances of Logging <watcher> found in solr.xml");
-    ConfigSolr cfg = ConfigSolr.fromString(loader, solrXml);
+    expectedException.expectMessage("Multiple instances of logging/watcher section found in solr.xml");
+    NodeConfig cfg = SolrXmlConfig.fromString(loader, solrXml);
   }
  
   public void testValidStringValueWhenBoolTypeIsExpected() throws IOException {
-    boolean genericCoreNodeNames = random().nextBoolean();
-    String solrXml = String.format(Locale.ROOT, "<solr><solrcloud><str name=\"genericCoreNodeNames\">%s</str></solrcloud></solr>", genericCoreNodeNames);
+    boolean schemaCache = random().nextBoolean();
+    String solrXml = String.format(Locale.ROOT, "<solr><str name=\"shareSchema\">%s</str></solr>", schemaCache);
 
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
-    assertEquals("gen core node names", genericCoreNodeNames, configSolr.getGenericCoreNodeNames());
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
+    assertEquals("gen core node names", schemaCache, nodeConfig.hasSchemaCache());
   }
 
   public void testValidStringValueWhenIntTypeIsExpected() throws IOException {
     int maxUpdateConnections = random().nextInt();
-    String solrXml = String.format(Locale.ROOT, "<solr><solrcloud><str name=\"maxUpdateConnections\">%d</str></solrcloud></solr>", maxUpdateConnections);
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
-    assertEquals("max update conn", maxUpdateConnections, configSolr.getMaxUpdateConnections());
+    String solrXml = String.format(Locale.ROOT, "<solr><updateshardhandler><str name=\"maxUpdateConnections\">%d</str></updateshardhandler></solr>", maxUpdateConnections);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
+    assertEquals("max update conn", maxUpdateConnections, nodeConfig.getUpdateShardHandlerConfig().getMaxUpdateConnections());
   }
 
   public void testFailAtConfigParseTimeWhenIntTypeIsExpectedAndLongTypeIsGiven() throws IOException {
@@ -185,26 +201,8 @@ public class TestSolrXml extends SolrTes
     String solrXml = String.format(Locale.ROOT, "<solr><solrcloud><long name=\"maxUpdateConnections\">%d</long></solrcloud></solr>", val);
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage(String.format(Locale.ROOT, "Value of '%d' can not be parsed as 'int'", val));
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
-  }
-
-  public void testFailAtConfigParseTimeWhenBoolTypeIsExpectedAndLongTypeIsGiven() throws IOException {
-    long val = random().nextLong();
-    String solrXml = String.format(Locale.ROOT, "<solr><solrcloud><long name=\"genericCoreNodeNames\">%d</long></solrcloud></solr>", val);
-
-    expectedException.expect(SolrException.class);
-    expectedException.expectMessage(String.format(Locale.ROOT, "Value of '%d' can not be parsed as 'bool'", val));
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
-  }
-
-  public void testFailAtConfigParseTimeWhenBoolTypeIsExpectedAndDoubleTypeIsGiven() throws IOException {
-    String val = ""+random().nextDouble();
-    String solrXml = String.format(Locale.ROOT, "<solr><solrcloud><double name=\"genericCoreNodeNames\">%s</double></solrcloud></solr>", val);
-
-    expectedException.expect(SolrException.class);
-    expectedException.expectMessage(String.format(Locale.ROOT, "Value of '%s' can not be parsed as 'bool'", val));
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    expectedException.expectMessage("Error parsing 'maxUpdateConnections'");
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testFailAtConfigParseTimeWhenBoolTypeIsExpectedAndValueIsInvalidString() throws IOException {
@@ -212,7 +210,7 @@ public class TestSolrXml extends SolrTes
 
     expectedException.expect(SolrException.class);
     expectedException.expectMessage("invalid boolean value: NOT_A_BOOLEAN");
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testFailAtConfigParseTimeWhenIntTypeIsExpectedAndBoolTypeIsGiven() throws IOException {
@@ -223,34 +221,34 @@ public class TestSolrXml extends SolrTes
     expectedException.expect(SolrException.class);
     expectedException.expectMessage(String.format(Locale.ROOT, "Value of 'unknown-option' can not be parsed as 'int': \"%s\"", randomBoolean));
 
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testFailAtConfigParseTimeWhenUnrecognizedSolrCloudOptionWasFound() throws IOException {
-    String solrXml = "<solr><solrcloud><bool name=\"unknown-option\">true</bool></solrcloud></solr>";
+    String solrXml = "<solr><solrcloud><str name=\"host\">host</str><int name=\"hostPort\">8983</int><str name=\"hostContext\"></str><bool name=\"unknown-option\">true</bool></solrcloud></solr>";
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage("<solrcloud> section of solr.xml contains 1 unknown config parameter(s): [unknown-option]");
+    expectedException.expectMessage("Unknown configuration parameter in <solrcloud> section of solr.xml: unknown-option");
     
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testFailAtConfigParseTimeWhenUnrecognizedSolrOptionWasFound() throws IOException {
     String solrXml = "<solr><bool name=\"unknown-bool-option\">true</bool><str name=\"unknown-str-option\">true</str></solr>";
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage("Main section of solr.xml contains 2 unknown config parameter(s): [unknown-bool-option, unknown-str-option]");
+    expectedException.expectMessage("Unknown configuration value in solr.xml: unknown-bool-option");
 
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testFailAtConfigParseTimeWhenUnrecognizedLoggingOptionWasFound() throws IOException {
     String solrXml = String.format(Locale.ROOT, "<solr><logging><bool name=\"unknown-option\">%s</bool></logging></solr>", random().nextBoolean());
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage("<logging> section of solr.xml contains 1 unknown config parameter(s): [unknown-option]");
+    expectedException.expectMessage("Unknown value in logwatcher config: unknown-option");
 
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testFailAtConfigParseTimeWhenLoggingConfigParamsAreDuplicated() throws IOException {
@@ -264,9 +262,9 @@ public class TestSolrXml extends SolrTes
                                    v1, v2);
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage(String.format(Locale.ROOT, "<logging> section of solr.xml contains duplicated 'class' in solr.xml: [%s, %s]", v1, v2));
+    expectedException.expectMessage("<logging> section of solr.xml contains duplicated 'class'");
 
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
   public void testFailAtConfigParseTimeWhenSolrCloudConfigParamsAreDuplicated() throws IOException {
@@ -283,11 +281,12 @@ public class TestSolrXml extends SolrTes
                                    v1, v2, v3);
     
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage(String.format(Locale.ROOT, "<solrcloud> section of solr.xml contains duplicated 'zkClientTimeout' in solr.xml: [%s, %s, %s]", v1, v2, v3));
+    expectedException.expectMessage("<solrcloud> section of solr.xml contains duplicated 'zkClientTimeout'");
 
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
   }
 
+  @Ignore
   public void testFailAtConfigParseTimeWhenSolrConfigParamsAreDuplicated() throws IOException {
     String v1 = ""+random().nextInt();
     String v2 = ""+random().nextInt();
@@ -299,9 +298,36 @@ public class TestSolrXml extends SolrTes
                                    v1, v2);
 
     expectedException.expect(SolrException.class);
-    expectedException.expectMessage(String.format(Locale.ROOT, "Main section of solr.xml contains duplicated 'coreLoadThreads' in solr.xml: [%s, %s]", v1, v2));
+    expectedException.expectMessage("Main section of solr.xml contains duplicated 'coreLoadThreads'");
+
+    NodeConfig nodeConfig = SolrXmlConfig.fromString(loader, solrXml);
+  }
+
+  public void testCloudConfigRequiresHost() throws Exception {
+
+    expectedException.expect(SolrException.class);
+    expectedException.expectMessage("solrcloud section missing required entry 'host'");
+
+    SolrXmlConfig.fromString(loader, "<solr><solrcloud></solrcloud></solr>");
+
+  }
+
+  public void testCloudConfigRequiresHostPort() throws Exception {
+
+    expectedException.expect(SolrException.class);
+    expectedException.expectMessage("solrcloud section missing required entry 'hostPort'");
+
+    SolrXmlConfig.fromString(loader, "<solr><solrcloud><str name=\"host\">host</str></solrcloud></solr>");
+
+  }
+
+  public void testCloudConfigRequiresHostContext() throws Exception {
+
+    expectedException.expect(SolrException.class);
+    expectedException.expectMessage("solrcloud section missing required entry 'hostContext'");
+
+    SolrXmlConfig.fromString(loader, "<solr><solrcloud><str name=\"host\">host</str><int name=\"hostPort\">8983</int></solrcloud></solr>");
 
-    ConfigSolr configSolr = ConfigSolr.fromString(loader, solrXml);
   }
 }
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java Wed Feb 25 14:45:51 2015
@@ -33,10 +33,7 @@ import org.apache.solr.common.cloud.ZkSt
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.UpdateParams;
 import org.apache.solr.common.util.NamedList;
-import org.apache.solr.core.ConfigSolr;
 import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.CoresLocator;
-import org.apache.solr.core.PluginInfo;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrEventListener;
 import org.apache.solr.search.SolrIndexSearcher;
@@ -73,23 +70,7 @@ public class SolrCmdDistributorTest exte
   private UpdateShardHandler updateShardHandler;
   
   public SolrCmdDistributorTest() throws ParserConfigurationException, IOException, SAXException {
-    updateShardHandler = new UpdateShardHandler(new ConfigSolr(null, null) {
-
-      @Override
-      public CoresLocator getCoresLocator() {
-        return null;
-      }
-
-      @Override
-      public PluginInfo getShardHandlerFactoryPluginInfo() {
-        return null;
-      }
-
-      @Override
-      protected String getProperty(CfgProp key) {
-        return null;
-      }
-    });
+    updateShardHandler = new UpdateShardHandler(UpdateShardHandlerConfig.DEFAULT);
     
     stress = 0;
   }

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Wed Feb 25 14:45:51 2015
@@ -46,9 +46,11 @@ import org.apache.solr.common.params.Mod
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.ObjectReleaseTracker;
 import org.apache.solr.common.util.XML;
-import org.apache.solr.core.ConfigSolr;
+import org.apache.solr.core.CoresLocator;
+import org.apache.solr.core.NodeConfig;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.CoreDescriptor;
+import org.apache.solr.core.SolrXmlConfig;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrResourceLoader;
@@ -309,14 +311,14 @@ public abstract class SolrTestCaseJ4 ext
    */
   public static void setupNoCoreTest(File solrHome, String xmlStr) throws Exception {
 
-    File tmpFile = new File(solrHome, ConfigSolr.SOLR_XML_FILE);
+    File tmpFile = new File(solrHome, SolrXmlConfig.SOLR_XML_FILE);
     if (xmlStr == null) {
       xmlStr = "<solr></solr>";
     }
     FileUtils.write(tmpFile, xmlStr, IOUtils.UTF_8);
 
     SolrResourceLoader loader = new SolrResourceLoader(solrHome.getAbsolutePath());
-    h = new TestHarness(ConfigSolr.fromFile(loader, new File(solrHome, "solr.xml")));
+    h = new TestHarness(SolrXmlConfig.fromFile(loader, new File(solrHome, "solr.xml")));
     lrf = h.getRequestFactory("standard", 0, 20, CommonParams.VERSION, "2.2");
   }
   
@@ -598,15 +600,17 @@ public abstract class SolrTestCaseJ4 ext
     return h.getCoreContainer();
   }
 
-  public static CoreContainer createCoreContainer(ConfigSolr config) {
+  public static CoreContainer createCoreContainer(NodeConfig config, CoresLocator locator) {
     testSolrHome = config.getSolrResourceLoader().getInstanceDir();
-    h = new TestHarness(config);
+    h = new TestHarness(config, locator);
     lrf = h.getRequestFactory("standard", 0, 20, CommonParams.VERSION, "2.2");
     return h.getCoreContainer();
   }
 
   public static CoreContainer createCoreContainer(String coreName, String dataDir, String solrConfig, String schema) {
-    CoreContainer cc = createCoreContainer(new TestHarness.TestConfigSolr(coreName, dataDir, solrConfig, schema));
+    NodeConfig nodeConfig = TestHarness.buildTestNodeConfig(new SolrResourceLoader(SolrResourceLoader.locateSolrHome()));
+    CoresLocator locator = new TestHarness.TestCoresLocator(coreName, dataDir, solrConfig, schema);
+    CoreContainer cc = createCoreContainer(nodeConfig, locator);
     h.coreName = coreName;
     return cc;
   }

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java?rev=1662232&r1=1662231&r2=1662232&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java Wed Feb 25 14:45:51 2015
@@ -23,14 +23,16 @@ import org.apache.solr.common.SolrExcept
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.NamedList.NamedListEntry;
-import org.apache.solr.core.ConfigSolr;
+import org.apache.solr.core.CloudConfig;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.CoreDescriptor;
+import org.apache.solr.core.CorePropertiesLocator;
 import org.apache.solr.core.CoresLocator;
-import org.apache.solr.core.PluginInfo;
+import org.apache.solr.core.NodeConfig;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.core.SolrXmlConfig;
 import org.apache.solr.handler.UpdateRequestHandler;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
@@ -41,6 +43,7 @@ import org.apache.solr.response.SolrQuer
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.IndexSchemaFactory;
 import org.apache.solr.servlet.DirectSolrConnection;
+import org.apache.solr.update.UpdateShardHandlerConfig;
 
 import java.io.File;
 import java.io.IOException;
@@ -130,8 +133,8 @@ public class TestHarness extends BaseTes
    * @param indexSchema schema resource name
    */
   public TestHarness(String coreName, String dataDir, String solrConfig, String indexSchema) {
-    this(new TestConfigSolr(new SolrResourceLoader(SolrResourceLoader.locateSolrHome()),
-                                                    coreName, dataDir, solrConfig, indexSchema));
+    this(buildTestNodeConfig(new SolrResourceLoader(SolrResourceLoader.locateSolrHome())),
+        new TestCoresLocator(coreName, dataDir, solrConfig, indexSchema));
     this.coreName = (coreName == null) ? SolrTestCaseJ4.DEFAULT_TEST_CORENAME : coreName;
   }
 
@@ -154,56 +157,41 @@ public class TestHarness extends BaseTes
    * @param solrXml the text of a solrxml
    */
   public TestHarness(SolrResourceLoader loader, String solrXml) {
-    this(ConfigSolr.fromString(loader, solrXml));
+    this(SolrXmlConfig.fromString(loader, solrXml));
+  }
+
+  public TestHarness(NodeConfig nodeConfig) {
+    this(nodeConfig, new CorePropertiesLocator(nodeConfig.getCoreRootDirectory()));
   }
 
   /**
    * Create a TestHarness using a specific config
    * @param config the ConfigSolr to use
    */
-  public TestHarness(ConfigSolr config) {
-    container = new CoreContainer(config);
+  public TestHarness(NodeConfig config, CoresLocator coresLocator) {
+    container = new CoreContainer(config, coresLocator);
     container.load();
     updater = new UpdateRequestHandler();
     updater.init(null);
   }
 
-  public static class TestConfigSolr extends ConfigSolr {
-
-    final CoresLocator locator;
-
-    public TestConfigSolr(String coreName, String dataDir, String solrConfig, String schema) {
-      this(new SolrResourceLoader(SolrResourceLoader.locateSolrHome()), coreName, dataDir, solrConfig, schema);
-    }
-
-    public TestConfigSolr(SolrResourceLoader loader, String coreName, String dataDir, String solrConfig, String schema) {
-      super(loader);
-      locator = new TestCoresLocator(coreName, dataDir, solrConfig, schema);
-    }
-
-    @Override
-    public CoresLocator getCoresLocator() {
-      return locator;
-    }
-
-    @Override
-    public PluginInfo getShardHandlerFactoryPluginInfo() {
-      return null;
-    }
-
-    @Override
-    protected String getProperty(CfgProp key) {
-      switch (key) {
-        case SOLR_HOST: return System.getProperty("host");
-        case SOLR_HOSTPORT: return System.getProperty("hostPort", "");
-        case SOLR_HOSTCONTEXT: return System.getProperty("hostContext", "");
-        case SOLR_DISTRIBUPDATESOTIMEOUT: return "30000";
-        case SOLR_ZKCLIENTTIMEOUT: return System.getProperty("zkClientTimeout", "30000");
-        case SOLR_DISTRIBUPDATECONNTIMEOUT: return "30000";
-        case SOLR_SHARESCHEMA: return System.getProperty("shareSchema", "false");
-      }
-      return null;
-    }
+  public static NodeConfig buildTestNodeConfig(SolrResourceLoader loader) {
+    CloudConfig cloudConfig = new CloudConfig.CloudConfigBuilder(System.getProperty("host"),
+                                                                 Integer.getInteger("hostPort", 8983),
+                                                                 System.getProperty("hostContext", ""))
+        .setZkClientTimeout(Integer.getInteger("zkClientTimeout", 30000))
+        .build();
+    if (System.getProperty("zkHost") == null)
+      cloudConfig = null;
+    UpdateShardHandlerConfig updateShardHandlerConfig
+        = new UpdateShardHandlerConfig(UpdateShardHandlerConfig.DEFAULT_MAXUPDATECONNECTIONS,
+                                       UpdateShardHandlerConfig.DEFAULT_MAXUPDATECONNECTIONSPERHOST,
+                                       30000, 30000);
+    return new NodeConfig.NodeConfigBuilder("testNode", loader)
+        .setUseSchemaCache(Boolean.getBoolean("shareSchema"))
+        .setCloudConfig(cloudConfig)
+        .setUpdateShardHandlerConfig(updateShardHandlerConfig)
+        .build();
   }
 
   public static class TestCoresLocator extends ReadOnlyCoresLocator {