You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rj...@apache.org on 2015/03/31 07:22:50 UTC

svn commit: r1670257 [32/39] - in /lucene/dev/branches/lucene6271: ./ dev-tools/ dev-tools/idea/.idea/libraries/ dev-tools/scripts/ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneou...

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java Tue Mar 31 05:22:40 2015
@@ -21,18 +21,19 @@ package org.apache.solr.core;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
-import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.handler.TestBlobHandler;
 import org.apache.solr.util.RESTfulServerProvider;
 import org.apache.solr.util.RestTestHarness;
 import org.apache.solr.util.SimplePostTool;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -40,6 +41,9 @@ import java.util.Map;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
+import static java.util.Arrays.asList;
+import static org.apache.solr.handler.TestSolrConfigHandlerCloud.compareValues;
+
 public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
   static final Logger log =  LoggerFactory.getLogger(TestDynamicLoading.class);
   private List<RestTestHarness> restTestHarnesses = new ArrayList<>();
@@ -56,6 +60,11 @@ public class TestDynamicLoading extends
     }
   }
 
+  @BeforeClass
+  public static void enableRuntimeLib() throws Exception {
+    System.setProperty("enable.runtime.lib", "true");
+  }
+
   @Override
   public void distribTearDown() throws Exception {
     super.distribTearDown();
@@ -66,51 +75,56 @@ public class TestDynamicLoading extends
 
   @Test
   public void testDynamicLoading() throws Exception {
+    System.setProperty("enable.runtime.lib", "true");
     setupHarnesses();
+
+    String blobName = "colltest";
+    boolean success = false;
+
+
+    HttpSolrClient randomClient = (HttpSolrClient) clients.get(random().nextInt(clients.size()));
+    String baseURL = randomClient.getBaseURL();
+    baseURL = baseURL.substring(0, baseURL.lastIndexOf('/'));
     String payload = "{\n" +
-        "'create-requesthandler' : { 'name' : '/test1', 'class': 'org.apache.solr.core.BlobStoreTestRequestHandler' , 'lib':'test','version':'1'}\n" +
+        "'add-runtimelib' : { 'name' : 'colltest' ,'version':1}\n" +
         "}";
     RestTestHarness client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
+    TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
+    TestSolrConfigHandler.testForResponseElement(client,
+        null,
+        "/config/overlay?wt=json",
+        null,
+        Arrays.asList("overlay", "runtimeLib", blobName, "version"),
+        1l, 10);
+
+
+    payload = "{\n" +
+        "'create-requesthandler' : { 'name' : '/test1', 'class': 'org.apache.solr.core.BlobStoreTestRequestHandler' , 'runtimeLib' : true }\n" +
+        "}";
+
+    client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
     TestSolrConfigHandler.runConfigCommand(client,"/config?wt=json",payload);
     TestSolrConfigHandler.testForResponseElement(client,
         null,
         "/config/overlay?wt=json",
         null,
-        Arrays.asList("overlay", "requestHandler", "/test1", "lib"),
-        "test",10);
+        Arrays.asList("overlay", "requestHandler", "/test1", "class"),
+        "org.apache.solr.core.BlobStoreTestRequestHandler",10);
 
     Map map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
 
-    assertNotNull(map = (Map) map.get("error"));
-    assertEquals(".system collection not available", map.get("msg"));
+    assertNotNull(TestBlobHandler.getAsString(map), map = (Map) map.get("error"));
+    assertEquals(TestBlobHandler.getAsString(map), ".system collection not available", map.get("msg"));
+
 
-    HttpSolrClient randomClient = (HttpSolrClient) clients.get(random().nextInt(clients.size()));
-    String baseURL = randomClient.getBaseURL();
-    baseURL = baseURL.substring(0, baseURL.lastIndexOf('/'));
     TestBlobHandler.createSystemCollection(new HttpSolrClient(baseURL, randomClient.getHttpClient()));
     waitForRecoveriesToFinish(".system", true);
 
     map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
 
-    assertNotNull(map = (Map) map.get("error"));
-    assertEquals("no such blob or version available: test/1", map.get("msg"));
-    ByteBuffer jar = generateZip( TestDynamicLoading.class,BlobStoreTestRequestHandler.class);
-    TestBlobHandler.postAndCheck(cloudClient, baseURL, jar,1);
-
-    boolean success= false;
-    for(int i=0;i<50;i++) {
-      map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
-      if(BlobStoreTestRequestHandler.class.getName().equals(map.get("class"))){
-        success = true;
-        break;
-      }
-      Thread.sleep(100);
-    }
-    assertTrue(new String( ZkStateReader.toJSON(map) , StandardCharsets.UTF_8), success );
-
-    jar = generateZip( TestDynamicLoading.class,BlobStoreTestRequestHandlerV2.class);
-    TestBlobHandler.postAndCheck(cloudClient, baseURL, jar,2);
 
+    assertNotNull(map = (Map) map.get("error"));
+    assertEquals("full output " + TestBlobHandler.getAsString(map), "no such blob or version available: colltest/1" , map.get("msg"));
     payload = " {\n" +
         "  'set' : {'watched': {" +
         "                    'x':'X val',\n" +
@@ -129,39 +143,111 @@ public class TestDynamicLoading extends
         10);
 
 
+
+
+    for(int i=0;i<100;i++) {
+      map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
+      if("X val".equals(map.get("x"))){
+         success = true;
+         break;
+      }
+      Thread.sleep(100);
+    }
+    ByteBuffer jar = null;
+
+//     jar = persistZip("/tmp/runtimelibs.jar.bin", TestDynamicLoading.class, RuntimeLibReqHandler.class, RuntimeLibResponseWriter.class, RuntimeLibSearchComponent.class);
+//    if(true) return;
+
+    jar = getFileContent("runtimecode/runtimelibs.jar.bin");
+    TestBlobHandler.postAndCheck(cloudClient, baseURL, blobName, jar, 1);
+
     payload = "{\n" +
-        "'update-requesthandler' : { 'name' : '/test1', 'class': 'org.apache.solr.core.BlobStoreTestRequestHandlerV2' , 'lib':'test','version':2}\n" +
+        "'create-requesthandler' : { 'name' : '/runtime', 'class': 'org.apache.solr.core.RuntimeLibReqHandler' , 'runtimeLib':true }," +
+        "'create-searchcomponent' : { 'name' : 'get', 'class': 'org.apache.solr.core.RuntimeLibSearchComponent' , 'runtimeLib':true }," +
+        "'create-queryResponseWriter' : { 'name' : 'json1', 'class': 'org.apache.solr.core.RuntimeLibResponseWriter' , 'runtimeLib':true }" +
         "}";
+    client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
+    TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
+
+    Map result = TestSolrConfigHandler.testForResponseElement(client,
+        null,
+        "/config/overlay?wt=json",
+        null,
+        Arrays.asList("overlay", "requestHandler", "/runtime", "class"),
+        "org.apache.solr.core.RuntimeLibReqHandler", 10);
+    compareValues(result, "org.apache.solr.core.RuntimeLibResponseWriter", asList("overlay", "queryResponseWriter", "json1", "class"));
+    compareValues(result, "org.apache.solr.core.RuntimeLibSearchComponent", asList("overlay", "searchComponent", "get", "class"));
+
+    result = TestSolrConfigHandler.testForResponseElement(client,
+        null,
+        "/runtime?wt=json",
+        null,
+        Arrays.asList("class"),
+        "org.apache.solr.core.RuntimeLibReqHandler", 10);
+    compareValues(result, MemClassLoader.class.getName(), asList( "loader"));
+
+    result = TestSolrConfigHandler.testForResponseElement(client,
+        null,
+        "/runtime?wt=json1",
+        null,
+        Arrays.asList("wt"),
+        "org.apache.solr.core.RuntimeLibResponseWriter", 10);
+    compareValues(result, MemClassLoader.class.getName(), asList( "loader"));
+
+    result = TestSolrConfigHandler.testForResponseElement(client,
+        null,
+        "/get?abc=xyz",
+        null,
+        Arrays.asList("get"),
+        "org.apache.solr.core.RuntimeLibSearchComponent", 10);
+    compareValues(result, MemClassLoader.class.getName(), asList( "loader"));
 
+    jar = getFileContent("runtimecode/runtimelibs_v2.jar.bin");
+    TestBlobHandler.postAndCheck(cloudClient, baseURL, blobName, jar, 2);
+    payload = "{\n" +
+        "'update-runtimelib' : { 'name' : 'colltest' ,'version':2}\n" +
+        "}";
     client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
-    TestSolrConfigHandler.runConfigCommand(client,"/config?wt=json",payload);
+    TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
     TestSolrConfigHandler.testForResponseElement(client,
         null,
         "/config/overlay?wt=json",
         null,
-        Arrays.asList("overlay", "requestHandler", "/test1", "version"),
-        2l,10);
+        Arrays.asList("overlay", "runtimeLib", blobName, "version"),
+        2l, 10);
 
-    success= false;
-    for(int i=0;i<100;i++) {
-      map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
-      if(BlobStoreTestRequestHandlerV2.class.getName().equals(map.get("class"))) {
-        success = true;
-        break;
-      }
-      Thread.sleep(100);
-    }
+    result = TestSolrConfigHandler.testForResponseElement(client,
+        null,
+        "/get?abc=xyz",
+        null,
+        Arrays.asList("Version"),
+        "2", 10);
 
-    assertTrue("New version of class is not loaded " + new String(ZkStateReader.toJSON(map), StandardCharsets.UTF_8), success);
 
-    for(int i=0;i<100;i++) {
-      map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
-      if("X val".equals(map.get("x"))){
-         success = true;
-         break;
-      }
-      Thread.sleep(100);
-    }
+    payload = " {\n" +
+        "  'set' : {'watched': {" +
+        "                    'x':'X val',\n" +
+        "                    'y': 'Y val'}\n" +
+        "             }\n" +
+        "  }";
+
+    TestSolrConfigHandler.runConfigCommand(client,"/config/params?wt=json",payload);
+    TestSolrConfigHandler.testForResponseElement(
+        client,
+        null,
+        "/config/params?wt=json",
+        cloudClient,
+        Arrays.asList("response", "params", "watched", "x"),
+        "X val",
+        10);
+   result = TestSolrConfigHandler.testForResponseElement(
+        client,
+        null,
+        "/test1?wt=json",
+        cloudClient,
+        Arrays.asList("x"),
+        "X val",
+        10);
 
     payload = " {\n" +
         "  'set' : {'watched': {" +
@@ -171,17 +257,33 @@ public class TestDynamicLoading extends
         "  }";
 
     TestSolrConfigHandler.runConfigCommand(client,"/config/params?wt=json",payload);
-    for(int i=0;i<50;i++) {
-      map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
-      if("X val changed".equals(map.get("x"))){
-        success = true;
-        break;
-      }
-      Thread.sleep(100);
-    }
-    assertTrue("listener did not get triggered" + new String(ZkStateReader.toJSON(map), StandardCharsets.UTF_8), success);
+    result = TestSolrConfigHandler.testForResponseElement(
+        client,
+        null,
+        "/test1?wt=json",
+        cloudClient,
+        Arrays.asList("x"),
+        "X val changed",
+        10);
+  }
 
+  public static ByteBuffer getFileContent(String f) throws IOException {
+    ByteBuffer jar;
+    try (FileInputStream fis = new FileInputStream(getFile(f))) {
+      byte[] buf = new byte[fis.available()];
+      fis.read(buf);
+      jar = ByteBuffer.wrap(buf);
+    }
+    return jar;
+  }
 
+  public static  ByteBuffer persistZip(String loc, Class... classes) throws IOException {
+    ByteBuffer jar = generateZip(classes);
+    try (FileOutputStream fos =  new FileOutputStream(loc)){
+      fos.write(jar.array(), 0, jar.limit());
+      fos.flush();
+    }
+    return jar;
   }
 
 

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestLazyCores.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestLazyCores.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestLazyCores.java Tue Mar 31 05:22:40 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/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java Tue Mar 31 05:22:40 2015
@@ -36,6 +36,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.common.util.StrUtils;
+import org.apache.solr.handler.TestBlobHandler;
 import org.apache.solr.handler.TestSolrConfigHandlerConcurrent;
 import org.apache.solr.util.RestTestBase;
 import org.apache.solr.util.RestTestHarness;
@@ -67,7 +68,7 @@ public class TestSolrConfigHandler exten
     tmpConfDir = new File(tmpSolrHome, confDir);
     FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
 
-    final SortedMap<ServletHolder,String> extraServlets = new TreeMap<>();
+    final SortedMap<ServletHolder, String> extraServlets = new TreeMap<>();
     final ServletHolder solrRestApi = new ServletHolder("SolrSchemaRestApi", ServerServlet.class);
     solrRestApi.setInitParameter("org.restlet.application", "org.apache.solr.rest.SolrSchemaRestApi");
     extraServlets.put(solrRestApi, "/schema/*");  // '/schema/*' matches '/schema', '/schema/', and '/schema/whatever...'
@@ -93,62 +94,63 @@ public class TestSolrConfigHandler exten
   }
 
 
-  public void testProperty() throws Exception{
+  public void testProperty() throws Exception {
     RestTestHarness harness = restTestHarness;
-    Map confMap =  getRespMap("/config?wt=json" ,harness);
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/luke")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/system")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/mbeans")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/plugins")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/threads")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/properties")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/logging")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/file")));
-    assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/ping")));
+    Map confMap = getRespMap("/config?wt=json", harness);
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/luke")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/system")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/mbeans")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/plugins")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/threads")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/properties")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/logging")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/file")));
+    assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/ping")));
 
-    String payload= "{\n" +
-        " 'set-property' : { 'updateHandler.autoCommit.maxDocs':100, 'updateHandler.autoCommit.maxTime':10 } \n" +
+    String payload = "{\n" +
+        " 'set-property' : { 'updateHandler.autoCommit.maxDocs':100, 'updateHandler.autoCommit.maxTime':10 , 'requestDispatcher.requestParsers.addHttpRequestToContext':true} \n" +
         " }";
-    runConfigCommand( harness,"/config?wt=json", payload);
+    runConfigCommand(harness, "/config?wt=json", payload);
 
-    Map m = (Map) getRespMap("/config/overlay?wt=json" ,harness).get("overlay");
+    Map m = (Map) getRespMap("/config/overlay?wt=json", harness).get("overlay");
     Map props = (Map) m.get("props");
     assertNotNull(props);
-    assertEquals("100",  String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs")) ));
-    assertEquals("10",  String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxTime")) ));
+    assertEquals("100", String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs"))));
+    assertEquals("10", String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxTime"))));
 
-    m = (Map) getRespMap("/config?wt=json" ,harness).get("config");
+    m = (Map) getRespMap("/config?wt=json", harness).get("config");
     assertNotNull(m);
 
-    assertEquals( "100",String.valueOf(getObjectByPath(m, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs"))));
-    assertEquals( "10",String.valueOf(getObjectByPath(m, true, ImmutableList.of("updateHandler", "autoCommit", "maxTime"))));
-    payload= "{\n" +
+    assertEquals("100", String.valueOf(getObjectByPath(m, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs"))));
+    assertEquals("10", String.valueOf(getObjectByPath(m, true, ImmutableList.of("updateHandler", "autoCommit", "maxTime"))));
+    assertEquals("true", String.valueOf(getObjectByPath(m, true, ImmutableList.of("requestDispatcher", "requestParsers", "addHttpRequestToContext"))));
+    payload = "{\n" +
         " 'unset-property' :  'updateHandler.autoCommit.maxDocs'} \n" +
         " }";
     runConfigCommand(harness, "/config?wt=json", payload);
 
-    m = (Map) getRespMap("/config/overlay?wt=json" ,harness).get("overlay");
+    m = (Map) getRespMap("/config/overlay?wt=json", harness).get("overlay");
     props = (Map) m.get("props");
     assertNotNull(props);
     assertNull(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs")));
-    assertEquals("10",  String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxTime"))));
+    assertEquals("10", String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxTime"))));
   }
 
-  public void testUserProp() throws Exception{
+  public void testUserProp() throws Exception {
     RestTestHarness harness = restTestHarness;
-    String payload= "{\n" +
+    String payload = "{\n" +
         " 'set-user-property' : { 'my.custom.variable.a':'MODIFIEDA'," +
         " 'my.custom.variable.b':'MODIFIEDB' } \n" +
         " }";
-    runConfigCommand(harness,"/config?wt=json", payload);
+    runConfigCommand(harness, "/config?wt=json", payload);
 
-    Map m = (Map) getRespMap("/config/overlay?wt=json" ,harness).get("overlay");
+    Map m = (Map) getRespMap("/config/overlay?wt=json", harness).get("overlay");
     Map props = (Map) m.get("userProps");
     assertNotNull(props);
     assertEquals(props.get("my.custom.variable.a"), "MODIFIEDA");
-    assertEquals(props.get("my.custom.variable.b"),"MODIFIEDB");
+    assertEquals(props.get("my.custom.variable.b"), "MODIFIEDB");
 
-    m = (Map) getRespMap("/dump?wt=json&json.nl=map&initArgs=true" ,harness).get("initArgs");
+    m = (Map) getRespMap("/dump?wt=json&json.nl=map&initArgs=true", harness).get("initArgs");
 
     m = (Map) m.get(PluginInfo.DEFAULTS);
     assertEquals("MODIFIEDA", m.get("a"));
@@ -157,21 +159,21 @@ public class TestSolrConfigHandler exten
   }
 
   public void testReqHandlerAPIs() throws Exception {
-    reqhandlertests(restTestHarness, null,null);
+    reqhandlertests(restTestHarness, null, null);
   }
 
-  public static void runConfigCommand(RestTestHarness harness, String uri,  String payload) throws IOException {
+  public static void runConfigCommand(RestTestHarness harness, String uri, String payload) throws IOException {
     String response = harness.post(uri, SolrTestCaseJ4.json(payload));
     Map map = (Map) ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
-    assertNull(response,  map.get("errors"));
+    assertNull(response, map.get("errors"));
   }
 
 
-  public static void reqhandlertests(RestTestHarness writeHarness,String testServerBaseUrl, CloudSolrClient cloudSolrServer) throws Exception {
+  public static void reqhandlertests(RestTestHarness writeHarness, String testServerBaseUrl, CloudSolrClient cloudSolrServer) throws Exception {
     String payload = "{\n" +
         "'create-requesthandler' : { 'name' : '/x', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy'}\n" +
         "}";
-    runConfigCommand(writeHarness,"/config?wt=json", payload);
+    runConfigCommand(writeHarness, "/config?wt=json", payload);
 
     testForResponseElement(writeHarness,
         testServerBaseUrl,
@@ -184,7 +186,7 @@ public class TestSolrConfigHandler exten
     payload = "{\n" +
         "'update-requesthandler' : { 'name' : '/x', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy' , 'a':'b' , 'defaults': {'def_a':'def A val'}}\n" +
         "}";
-    runConfigCommand(writeHarness,"/config?wt=json", payload);
+    runConfigCommand(writeHarness, "/config?wt=json", payload);
 
     testForResponseElement(writeHarness,
         testServerBaseUrl,
@@ -205,21 +207,21 @@ public class TestSolrConfigHandler exten
     payload = "{\n" +
         "'delete-requesthandler' : '/x'" +
         "}";
-    runConfigCommand(writeHarness,"/config?wt=json", payload);
+    runConfigCommand(writeHarness, "/config?wt=json", payload);
     boolean success = false;
     long startTime = System.nanoTime();
     int maxTimeoutSeconds = 10;
-    while ( TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS) < maxTimeoutSeconds) {
+    while (TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS) < maxTimeoutSeconds) {
       String uri = "/config/overlay?wt=json";
-      Map m = testServerBaseUrl ==null?  getRespMap(uri,writeHarness) : TestSolrConfigHandlerConcurrent.getAsMap(testServerBaseUrl+uri ,cloudSolrServer) ;
-      if(null == ConfigOverlay.getObjectByPath(m,  true, Arrays.asList("overlay", "requestHandler", "/x","a"))) {
+      Map m = testServerBaseUrl == null ? getRespMap(uri, writeHarness) : TestSolrConfigHandlerConcurrent.getAsMap(testServerBaseUrl + uri, cloudSolrServer);
+      if (null == ConfigOverlay.getObjectByPath(m, true, Arrays.asList("overlay", "requestHandler", "/x", "a"))) {
         success = true;
         break;
       }
       Thread.sleep(100);
 
     }
-    assertTrue( "Could not delete requestHandler  ", success);
+    assertTrue("Could not delete requestHandler  ", success);
 
     payload = "{\n" +
         "'create-queryconverter' : { 'name' : 'qc', 'class': 'org.apache.solr.spelling.SpellingQueryConverter'}\n" +
@@ -290,7 +292,7 @@ public class TestSolrConfigHandler exten
         Arrays.asList("config", "searchComponent", "tc"),
         null,
         10);
-   //<valueSourceParser name="countUsage" class="org.apache.solr.core.CountUsageValueSourceParser"/>
+    //<valueSourceParser name="countUsage" class="org.apache.solr.core.CountUsageValueSourceParser"/>
     payload = "{\n" +
         "'create-valuesourceparser' : { 'name' : 'cu', 'class': 'org.apache.solr.core.CountUsageValueSourceParser'}\n" +
         "}";
@@ -351,15 +353,16 @@ public class TestSolrConfigHandler exten
         testServerBaseUrl,
         "/config?wt=json",
         cloudSolrServer,
-        Arrays.asList("config", "transformer","mytrans","value"),
+        Arrays.asList("config", "transformer", "mytrans", "value"),
         "6",
         10);
 
     payload = "{\n" +
-        "'delete-transformer' : 'mytrans'" +
+        "'delete-transformer' : 'mytrans'," +
+        "'create-initparams' : { 'name' : 'hello', 'key':'val'}\n" +
         "}";
     runConfigCommand(writeHarness, "/config?wt=json", payload);
-    testForResponseElement(writeHarness,
+    Map map = testForResponseElement(writeHarness,
         testServerBaseUrl,
         "/config?wt=json",
         cloudSolrServer,
@@ -367,28 +370,32 @@ public class TestSolrConfigHandler exten
         null,
         10);
 
+    List l = (List) ConfigOverlay.getObjectByPath(map,false, Arrays.asList("config", "initParams"));
+    assertNotNull("no object /config/initParams : "+ TestBlobHandler.getAsString(map) , l);
+    assertEquals( 1, l.size());
+    assertEquals( "val", ((Map)l.get(0)).get("key") );
   }
 
   public static Map testForResponseElement(RestTestHarness harness,
-                                            String testServerBaseUrl,
-                                            String uri,
-                                            CloudSolrClient cloudSolrServer,List<String> jsonPath,
-                                            Object expected,
-                                            long maxTimeoutSeconds ) throws Exception {
+                                           String testServerBaseUrl,
+                                           String uri,
+                                           CloudSolrClient cloudSolrServer, List<String> jsonPath,
+                                           Object expected,
+                                           long maxTimeoutSeconds) throws Exception {
 
     boolean success = false;
     long startTime = System.nanoTime();
     Map m = null;
 
-    while ( TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS) < maxTimeoutSeconds) {
+    while (TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS) < maxTimeoutSeconds) {
       try {
-        m = testServerBaseUrl ==null?  getRespMap(uri,harness) : TestSolrConfigHandlerConcurrent.getAsMap(testServerBaseUrl + uri, cloudSolrServer) ;
+        m = testServerBaseUrl == null ? getRespMap(uri, harness) : TestSolrConfigHandlerConcurrent.getAsMap(testServerBaseUrl + uri, cloudSolrServer);
       } catch (Exception e) {
         Thread.sleep(100);
         continue;
 
       }
-      if(Objects.equals(expected,ConfigOverlay.getObjectByPath(m, false, jsonPath))) {
+      if (Objects.equals(expected, ConfigOverlay.getObjectByPath(m, false, jsonPath))) {
         success = true;
         break;
       }
@@ -396,11 +403,11 @@ public class TestSolrConfigHandler exten
 
     }
 
-    assertTrue(MessageFormat.format("Could not get expected value  ''{0}'' for path ''{1}'' full output: {2}", expected, StrUtils.join(jsonPath, '/'), getAsString(m)), success);
+    assertTrue(StrUtils.formatString("Could not get expected value  ''{0}'' for path ''{1}'' full output: {2}", expected, StrUtils.join(jsonPath, '/'), getAsString(m)), success);
     return m;
   }
 
-  public void testReqParams() throws Exception{
+  public void testReqParams() throws Exception {
     RestTestHarness harness = restTestHarness;
     String payload = " {\n" +
         "  'set' : {'x': {" +
@@ -410,7 +417,7 @@ public class TestSolrConfigHandler exten
         "  }";
 
 
-    TestSolrConfigHandler.runConfigCommand(harness,"/config/params?wt=json", payload);
+    TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
 
     TestSolrConfigHandler.testForResponseElement(
         harness,
@@ -464,7 +471,7 @@ public class TestSolrConfigHandler exten
         "'create-requesthandler' : { 'name' : '/dump1', 'class': 'org.apache.solr.handler.DumpRequestHandler', 'useParams':'x' }\n" +
         "}";
 
-    TestSolrConfigHandler.runConfigCommand(harness,"/config?wt=json", payload);
+    TestSolrConfigHandler.runConfigCommand(harness, "/config?wt=json", payload);
 
     TestSolrConfigHandler.testForResponseElement(harness,
         null,
@@ -484,7 +491,6 @@ public class TestSolrConfigHandler exten
         5);
 
 
-
     payload = " {\n" +
         "  'set' : {'y':{\n" +
         "                'c':'CY val',\n" +
@@ -494,7 +500,7 @@ public class TestSolrConfigHandler exten
         "  }";
 
 
-    TestSolrConfigHandler.runConfigCommand(harness,"/config/params?wt=json", payload);
+    TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
 
     TestSolrConfigHandler.testForResponseElement(
         harness,
@@ -538,7 +544,7 @@ public class TestSolrConfigHandler exten
         "/dump1?wt=json&useParams=y",
         null,
         Arrays.asList("params", "d"),
-        Arrays.asList("val 1", "val 2") ,
+        Arrays.asList("val 1", "val 2"),
         5);
 
     payload = " {\n" +
@@ -551,7 +557,7 @@ public class TestSolrConfigHandler exten
         "  }";
 
 
-    TestSolrConfigHandler.runConfigCommand(harness,"/config/params?wt=json", payload);
+    TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
 
     TestSolrConfigHandler.testForResponseElement(
         harness,
@@ -580,7 +586,7 @@ public class TestSolrConfigHandler exten
         "  }";
 
 
-    TestSolrConfigHandler.runConfigCommand(harness,"/config/params?wt=json", payload);
+    TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
     TestSolrConfigHandler.testForResponseElement(
         harness,
         null,
@@ -599,7 +605,7 @@ public class TestSolrConfigHandler exten
         null,
         10);
     payload = " {'delete' : 'y'}";
-    TestSolrConfigHandler.runConfigCommand(harness,"/config/params?wt=json", payload);
+    TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
     TestSolrConfigHandler.testForResponseElement(
         harness,
         null,

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrXml.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrXml.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrXml.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/core/TestSolrXml.java Tue Mar 31 05:22:40 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/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java Tue Mar 31 05:22:40 2015
@@ -31,6 +31,8 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -356,7 +358,7 @@ public class FieldAnalysisRequestHandler
 
     NamedList indexPart = textType.get("index");
     assertNotNull("expecting an index token analysis for field type 'charfilthtmlmap'", indexPart);
-    
+
     assertEquals("\n\nwhátëvêr\n\n", indexPart.get("org.apache.lucene.analysis.charfilter.HTMLStripCharFilter"));
     assertEquals("\n\nwhatever\n\n", indexPart.get("org.apache.lucene.analysis.charfilter.MappingCharFilter"));
 
@@ -365,7 +367,7 @@ public class FieldAnalysisRequestHandler
     assertEquals(tokenList.size(), 1);
     assertToken(tokenList.get(0), new TokenInfo("whatever", null, "word", 12, 20, 1, new int[]{1}, null, false));
   }
-  
+
   @Test
   public void testPositionHistoryWithWDF() throws Exception {
 
@@ -411,4 +413,24 @@ public class FieldAnalysisRequestHandler
     assertToken(tokenList.get(4), new TokenInfo("a", null, "word", 12, 13, 4, new int[]{3,4,4}, null, false));
     assertToken(tokenList.get(5), new TokenInfo("test", null, "word", 14, 18, 5, new int[]{4,5,5}, null, false));
   }
+
+  @Test
+  public void testSpatial() throws Exception {
+    FieldAnalysisRequest request = new FieldAnalysisRequest();
+    request.addFieldType("location_rpt");
+    request.setFieldValue("MULTIPOINT ((10 40), (40 30), (20 20), (30 10))");
+
+    NamedList<NamedList> result = handler.handleAnalysisRequest(request, h.getCore().getLatestSchema());
+    NamedList<List<NamedList>> tokens = (NamedList<List<NamedList>>)
+        ((NamedList)result.get("field_types").get("location_rpt")).get("index");
+    List<NamedList> tokenList = tokens.get("org.apache.lucene.spatial.prefix.BytesRefIteratorTokenStream");
+
+
+    List<String> vals = new ArrayList<>(tokenList.size());
+    for(NamedList v : tokenList) {
+      vals.add( (String)v.get("text") );
+    }
+    Collections.sort(vals);
+    assertEquals( "[s, s7, s7w, s7w1+, s9, s9v, s9v2+, sp, spp, spp5+, sv, svk, svk6+]", vals.toString() );
+  }
 }

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java Tue Mar 31 05:22:40 2015
@@ -91,11 +91,13 @@ public class MoreLikeThisHandlerTest ext
         ,"//result/doc[2]/int[@name='id'][.='43']");
     
     params.set(CommonParams.Q, "id:44");
+    mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
     assertQ("morelike this - harrison ford",mltreq
         ,"//result/doc[1]/int[@name='id'][.='45']");
 
     // test MoreLikeThis debug
     params.set(CommonParams.DEBUG_QUERY, "true");
+    mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
     assertQ("morelike this - harrison ford",mltreq
         ,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='rawMLTQuery']"
         ,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='boostedMLTQuery']"
@@ -106,11 +108,13 @@ public class MoreLikeThisHandlerTest ext
     // test that qparser plugins work
     params.remove(CommonParams.DEBUG_QUERY);
     params.set(CommonParams.Q, "{!field f=id}44");
+    mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
     assertQ(mltreq
         ,"//result/doc[1]/int[@name='id'][.='45']");
 
     params.set(CommonParams.Q, "id:42");
     params.set(MoreLikeThisParams.QF,"name^5.0 subword^0.1");
+    mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
     assertQ("morelikethis with weights",mltreq
         ,"//result/doc[1]/int[@name='id'][.='43']"
         ,"//result/doc[2]/int[@name='id'][.='46']");
@@ -119,12 +123,14 @@ public class MoreLikeThisHandlerTest ext
     // test that qparser plugins work w/ the MoreLikeThisHandler
     params.set(CommonParams.QT, "/mlt");
     params.set(CommonParams.Q, "{!field f=id}44");
+    mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
     assertQ(mltreq
         ,"//result/doc[1]/int[@name='id'][.='45']");
 
     // test that debugging works (test for MoreLikeThis*Handler*)
     params.set(CommonParams.QT, "/mlt");
     params.set(CommonParams.DEBUG_QUERY, "true");
+    mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
     assertQ(mltreq
         ,"//result/doc[1]/int[@name='id'][.='45']"
         ,"//lst[@name='debug']/lst[@name='explain']"
@@ -134,5 +140,6 @@ public class MoreLikeThisHandlerTest ext
     // String response = h.query(mltreq);
     // System.out.println(response);
 
+    mltreq.close();
   }
 }

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java Tue Mar 31 05:22:40 2015
@@ -51,27 +51,19 @@ public class StandardRequestHandlerTest
     assertU(adoc("id", "11", "title", "test", "val_s1", "bbb"));
     assertU(adoc("id", "12", "title", "test", "val_s1", "ccc"));
     assertU(commit());
-    
-    Map<String,String> args = new HashMap<>();
-    args.put( CommonParams.Q, "title:test" );
-    args.put( "indent", "true" );
-    SolrQueryRequest req = new LocalSolrQueryRequest( core, new MapSolrParams( args) );
-    
-    
-    assertQ("Make sure they got in", req
+
+    assertQ(req("q", "title:test")
             ,"//*[@numFound='3']"
             );
     
-    args.put( CommonParams.SORT, "val_s1 asc" );
-    assertQ("with sort param [asc]", req
+    assertQ(req("q", "title:test", "sort","val_s1 asc")
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='10']"
             ,"//result/doc[2]/int[@name='id'][.='11']"
             ,"//result/doc[3]/int[@name='id'][.='12']"
             );
 
-    args.put( CommonParams.SORT, "val_s1 desc" );
-    assertQ("with sort param [desc]", req
+    assertQ(req("q", "title:test", "sort","val_s1 desc")
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='12']"
             ,"//result/doc[2]/int[@name='id'][.='11']"
@@ -79,25 +71,23 @@ public class StandardRequestHandlerTest
             );
     
     // Make sure score parsing works
-    args.put( CommonParams.SORT, "score desc" );
-    assertQ("with sort param [desc]", req,"//*[@numFound='3']" );
+    assertQ(req("q", "title:test", "sort","score desc")
+        ,"//*[@numFound='3']"
+    );
 
-    args.put( CommonParams.SORT, "score asc" );
-    assertQ("with sort param [desc]", req,"//*[@numFound='3']" );
+    assertQ(req("q", "title:test", "sort","score asc")
+        ,"//*[@numFound='3']"
+    );
     
     // Using legacy ';' param
-    args.remove( CommonParams.SORT );
-    args.put( QueryParsing.DEFTYPE, "lucenePlusSort" );
-    args.put( CommonParams.Q, "title:test; val_s1 desc" );
-    assertQ("with sort param [desc]", req
+    assertQ(req("q", "title:test; val_s1 desc", "defType","lucenePlusSort")
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='12']"
             ,"//result/doc[2]/int[@name='id'][.='11']"
             ,"//result/doc[3]/int[@name='id'][.='10']"
             );
 
-    args.put( CommonParams.Q, "title:test; val_s1 asc" );
-    assertQ("with sort param [asc]", req
+    assertQ(req("q", "title:test; val_s1 asc", "defType","lucenePlusSort")
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='10']"
             ,"//result/doc[2]/int[@name='id'][.='11']"

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestBlobHandler.java Tue Mar 31 05:22:40 2015
@@ -34,6 +34,7 @@ import org.apache.solr.cloud.AbstractFul
 import org.apache.solr.common.cloud.DocCollection;
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.core.ConfigOverlay;
 import org.apache.solr.update.DirectUpdateHandler2;
 import org.apache.solr.util.SimplePostTool;
@@ -47,7 +48,6 @@ import java.io.IOException;
 import java.io.StringReader;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
-import java.text.MessageFormat;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -55,7 +55,7 @@ import java.util.Map;
 import static org.apache.solr.core.ConfigOverlay.getObjectByPath;
 
 public class TestBlobHandler extends AbstractFullDistribZkTestBase {
-  static final Logger log =  LoggerFactory.getLogger(TestBlobHandler.class);
+  static final Logger log = LoggerFactory.getLogger(TestBlobHandler.class);
 
   @Test
   public void doBlobHandlerTest() throws Exception {
@@ -82,23 +82,24 @@ public class TestBlobHandler extends Abs
           "/blob",
           "class")));
 
-      byte[] bytarr  = new byte[1024];
-      for (int i = 0; i < bytarr.length; i++) bytarr[i]= (byte) (i % 127);
-      byte[] bytarr2  = new byte[2048];
-      for (int i = 0; i < bytarr2.length; i++) bytarr2[i]= (byte) (i % 127);
-      postAndCheck(cloudClient, baseUrl, ByteBuffer.wrap( bytarr), 1);
-      postAndCheck(cloudClient, baseUrl, ByteBuffer.wrap( bytarr2), 2);
+      byte[] bytarr = new byte[1024];
+      for (int i = 0; i < bytarr.length; i++) bytarr[i] = (byte) (i % 127);
+      byte[] bytarr2 = new byte[2048];
+      for (int i = 0; i < bytarr2.length; i++) bytarr2[i] = (byte) (i % 127);
+      String blobName = "test";
+      postAndCheck(cloudClient, baseUrl, blobName, ByteBuffer.wrap(bytarr), 1);
+      postAndCheck(cloudClient, baseUrl, blobName, ByteBuffer.wrap(bytarr2), 2);
 
       url = baseUrl + "/.system/blob/test/1";
-      map = TestSolrConfigHandlerConcurrent.getAsMap(url,cloudClient);
+      map = TestSolrConfigHandlerConcurrent.getAsMap(url, cloudClient);
       List l = (List) ConfigOverlay.getObjectByPath(map, false, Arrays.asList("response", "docs"));
-      assertNotNull(""+map, l);
+      assertNotNull("" + map, l);
       assertTrue("" + map, l.size() > 0);
       map = (Map) l.get(0);
-      assertEquals(""+bytarr.length,String.valueOf(map.get("size")));
+      assertEquals("" + bytarr.length, String.valueOf(map.get("size")));
 
-      compareInputAndOutput(baseUrl+"/.system/blob/test?wt=filestream", bytarr2);
-      compareInputAndOutput(baseUrl+"/.system/blob/test/1?wt=filestream", bytarr);
+      compareInputAndOutput(baseUrl + "/.system/blob/test?wt=filestream", bytarr2);
+      compareInputAndOutput(baseUrl + "/.system/blob/test/1?wt=filestream", bytarr);
     }
   }
 
@@ -123,19 +124,19 @@ public class TestBlobHandler extends Abs
     DirectUpdateHandler2.commitOnClose = true;
   }
 
-  public static void postAndCheck(CloudSolrClient cloudClient, String baseUrl, ByteBuffer bytes, int count) throws Exception {
-    postData(cloudClient, baseUrl, bytes);
+  public static void postAndCheck(CloudSolrClient cloudClient, String baseUrl, String blobName, ByteBuffer bytes, int count) throws Exception {
+    postData(cloudClient, baseUrl, blobName, bytes);
 
     String url;
     Map map = null;
     List l;
     long start = System.currentTimeMillis();
-    int i=0;
-    for(;i<150;i++) {//15 secs
-      url = baseUrl + "/.system/blob/test";
+    int i = 0;
+    for (; i < 150; i++) {//15 secs
+      url = baseUrl + "/.system/blob/" + blobName;
       map = TestSolrConfigHandlerConcurrent.getAsMap(url, cloudClient);
       String numFound = String.valueOf(ConfigOverlay.getObjectByPath(map, false, Arrays.asList("response", "numFound")));
-      if(!(""+count).equals(numFound)) {
+      if (!("" + count).equals(numFound)) {
         Thread.sleep(100);
         continue;
       }
@@ -145,8 +146,8 @@ public class TestBlobHandler extends Abs
       assertEquals("" + bytes.limit(), String.valueOf(map.get("size")));
       return;
     }
-    fail(MessageFormat.format("Could not successfully add blob after {0} attempts. Expecting {1} items. time elapsed {2}  output  for url is {3}",
-        i,count, System.currentTimeMillis()-start,  getAsString(map)));
+    fail(StrUtils.formatString("Could not successfully add blob after {0} attempts. Expecting {1} items. time elapsed {2}  output  for url is {3}",
+        i, count, System.currentTimeMillis() - start, getAsString(map)));
   }
 
   public static String getAsString(Map map) {
@@ -171,21 +172,21 @@ public class TestBlobHandler extends Abs
 
   }
 
-  public static void postData(CloudSolrClient cloudClient, String baseUrl, ByteBuffer bytarr) throws IOException {
+  public static void postData(CloudSolrClient cloudClient, String baseUrl, String blobName, ByteBuffer bytarr) throws IOException {
     HttpPost httpPost = null;
     HttpEntity entity;
     String response = null;
     try {
-      httpPost = new HttpPost(baseUrl+"/.system/blob/test");
-      httpPost.setHeader("Content-Type","application/octet-stream");
+      httpPost = new HttpPost(baseUrl + "/.system/blob/" + blobName);
+      httpPost.setHeader("Content-Type", "application/octet-stream");
       httpPost.setEntity(new ByteArrayEntity(bytarr.array(), bytarr.arrayOffset(), bytarr.limit()));
       entity = cloudClient.getLbClient().getHttpClient().execute(httpPost).getEntity();
       try {
         response = EntityUtils.toString(entity, StandardCharsets.UTF_8);
         Map m = (Map) ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
-        assertFalse("Error in posting blob "+ getAsString(m),m.containsKey("error"));
+        assertFalse("Error in posting blob " + getAsString(m), m.containsKey("error"));
       } catch (JSONParser.ParseException e) {
-        log.error(response);
+        log.error("$ERROR$", response, e);
         fail();
       }
     } finally {

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java Tue Mar 31 05:22:40 2015
@@ -41,6 +41,7 @@ import org.apache.solr.common.cloud.Slic
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.cloud.ZkConfigManager;
 import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.util.RESTfulServerProvider;
 import org.apache.solr.util.RestTestHarness;
@@ -136,7 +137,7 @@ public class TestConfigReload extends Ab
       if(succeeded.size() == urls.size()) break;
       succeeded.clear();
     }
-    assertEquals(MessageFormat.format("tried these servers {0} succeeded only in {1} ", urls,succeeded) , urls.size(), succeeded.size());
+    assertEquals(StrUtils.formatString("tried these servers {0} succeeded only in {1} ", urls, succeeded) , urls.size(), succeeded.size());
   }
 
   private  Map getAsMap(String uri) throws Exception {

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Tue Mar 31 05:22:40 2015
@@ -18,7 +18,6 @@ package org.apache.solr.handler;
 
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.BaseDistributedSearchTestCase;
@@ -172,18 +171,14 @@ public class TestReplicationHandler exte
     return s.add(doc).getStatus();
   }
 
-  NamedList query(String query, SolrClient s) throws SolrServerException {
-    NamedList res = new SimpleOrderedMap();
+  NamedList query(String query, SolrClient s) throws SolrServerException, IOException {
     ModifiableSolrParams params = new ModifiableSolrParams();
 
     params.add("q", query);
     params.add("sort","id desc");
 
     QueryResponse qres = s.query(params);
-
-    res = qres.getResponse();
-
-    return res;
+    return qres.getResponse();
   }
 
   /** will sleep up to 30 seconds, looking for expectedDocCount */
@@ -305,9 +300,10 @@ public class TestReplicationHandler exte
       assertNotNull("slave has slave section", 
                     details.get("slave"));
       // SOLR-2677: assert not false negatives
-      Object timesFailed = ((NamedList)details.get("slave")).get(SnapPuller.TIMES_FAILED);
-      assertEquals("slave has fetch error count",
-                   null, timesFailed);
+      Object timesFailed = ((NamedList)details.get("slave")).get(IndexFetcher.TIMES_FAILED);
+      // SOLR-7134: we can have a fail because some mock index files have no checksum, will
+      // always be downloaded, and may not be able to be moved into the existing index
+      assertTrue("slave has fetch error count: " + (String)timesFailed, timesFailed == null || ((String) timesFailed).equals("1"));
 
       if (3 != i) {
         // index & fetch
@@ -514,7 +510,7 @@ public class TestReplicationHandler exte
     slaveClient.close();
     slaveClient = createNewSolrClient(slaveJetty.getLocalPort());
 
-    //add a doc with new field and commit on master to trigger snappull from slave.
+    //add a doc with new field and commit on master to trigger index fetch from slave.
     index(masterClient, "id", "2000", "name", "name = " + 2000, "newname", "newname = " + 2000);
     masterClient.commit();
 
@@ -582,7 +578,7 @@ public class TestReplicationHandler exte
   }
 
   @Test
-  public void doTestSnapPullWithMasterUrl() throws Exception {
+  public void doTestIndexFetchWithMasterUrl() throws Exception {
     //change solrconfig on slave
     //this has no entry for pollinginterval
     slave.copyConfigFile(CONF_DIR + "solrconfig-slave1.xml", "solrconfig.xml");
@@ -609,7 +605,7 @@ public class TestReplicationHandler exte
     SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
     assertEquals(nDocs, masterQueryResult.getNumFound());
 
-    // snappull
+    // index fetch
     String masterUrl = buildUrl(slaveJetty.getLocalPort()) + "/" + DEFAULT_TEST_CORENAME + "/replication?command=fetchindex&masterUrl=";
     masterUrl += buildUrl(masterJetty.getLocalPort()) + "/" + DEFAULT_TEST_CORENAME + "/replication";
     URL url = new URL(masterUrl);
@@ -624,7 +620,7 @@ public class TestReplicationHandler exte
     String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
     assertEquals(null, cmp);
 
-    // snappull from the slave to the master
+    // index fetch from the slave to the master
     
     for (int i = nDocs; i < nDocs + 3; i++)
       index(slaveClient, "id", i, "name", "name = " + i);
@@ -766,7 +762,7 @@ public class TestReplicationHandler exte
             .get("response");
         assertEquals(totalDocs, masterQueryResult.getNumFound());
         
-        // snappull
+        // index fetch
         Date slaveCoreStart = watchCoreStartAt(slaveClient, 30*1000, null);
         pullFromMasterToSlave();
         if (confCoreReload) {
@@ -1055,7 +1051,7 @@ public class TestReplicationHandler exte
       // tries to
       // replicate
       masterJetty.stop();
-      masterJetty.start(true);
+      masterJetty.start();
       
       // masterClient = createNewSolrClient(masterJetty.getLocalPort());
       
@@ -1220,7 +1216,7 @@ public class TestReplicationHandler exte
     // record collection1's start time on slave
     final Date slaveStartTime = watchCoreStartAt(slaveClient, 30*1000, null);
 
-    //add a doc with new field and commit on master to trigger snappull from slave.
+    //add a doc with new field and commit on master to trigger index fetch from slave.
     index(masterClient, "id", "2000", "name", "name = " + 2000, "newname", "n2000");
     masterClient.commit();
     rQuery(1, "newname:n2000", masterClient);  // sanity check

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java Tue Mar 31 05:22:40 2015
@@ -21,6 +21,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -130,18 +131,18 @@ public class TestReplicationHandlerBacku
     }
 
     //Validate
-    Path snapDir = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*").iterator().next();
-    verify(snapDir, nDocs);
+    try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*")) {
+      Path snapDir = stream.iterator().next();
+      verify(snapDir, nDocs);
+    }
   }
 
   private void verify(Path backup, int nDocs) throws IOException {
-    try (Directory dir = new SimpleFSDirectory(backup)) {
-      IndexReader reader = DirectoryReader.open(dir);
+    try (Directory dir = new SimpleFSDirectory(backup);
+        IndexReader reader = DirectoryReader.open(dir)) {
       IndexSearcher searcher = new IndexSearcher(reader);
       TopDocs hits = searcher.search(new MatchAllDocsQuery(), 1);
       assertEquals(nDocs, hits.totalHits);
-      reader.close();
-      dir.close();
     }
   }
 
@@ -167,7 +168,10 @@ public class TestReplicationHandlerBacku
 
     Path[] snapDir = new Path[5]; //One extra for the backup on commit
     //First snapshot location
-    snapDir[0] = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*").iterator().next();
+    try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*")) {
+      snapDir[0] = stream.iterator().next();
+    }
+
     boolean namedBackup = random().nextBoolean();
     String firstBackupTimestamp = null;
 
@@ -199,14 +203,19 @@ public class TestReplicationHandlerBacku
       }
 
       if (!namedBackup) {
-        snapDir[i+1] = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*").iterator().next();
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*")) {
+          snapDir[i+1] = stream.iterator().next();
+        }
       } else {
-        snapDir[i+1] = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot." + backupName).iterator().next();
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot." + backupName)) {
+          snapDir[i+1] = stream.iterator().next();
+        }
       }
       verify(snapDir[i+1], nDocs);
 
     }
 
+    
     //Test Deletion of named backup
     if (namedBackup) {
       testDeleteNamedBackup(backupNames);
@@ -214,10 +223,12 @@ public class TestReplicationHandlerBacku
       //5 backups got created. 4 explicitly and one because a commit was called.
       // Only the last two should still exist.
       int count =0;
-      Iterator<Path> iter = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*").iterator();
-      while (iter.hasNext()) {
-        iter.next();
-        count ++;
+      try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*")) {
+        Iterator<Path> iter = stream.iterator();
+        while (iter.hasNext()) {
+          iter.next();
+          count ++;
+        }
       }
 
       //There will be 2 backups, otherwise 1

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerCloud.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerCloud.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerCloud.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerCloud.java Tue Mar 31 05:22:40 2015
@@ -34,6 +34,7 @@ import org.apache.solr.common.cloud.DocC
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.core.ConfigOverlay;
 import org.apache.solr.core.RequestParams;
 import org.apache.solr.core.TestSolrConfigHandler;
@@ -266,7 +267,7 @@ public class TestSolrConfigHandlerCloud
   }
 
   public static void compareValues(Map result, Object expected, List<String> jsonPath) {
-    assertTrue(MessageFormat.format("Could not get expected value  {0} for path {1} full output {2}", expected, jsonPath, getAsString(result)),
+    assertTrue(StrUtils.formatString("Could not get expected value  {0} for path {1} full output {2}", expected, jsonPath, getAsString(result)),
         Objects.equals(expected, ConfigOverlay.getObjectByPath(result, false, jsonPath)));
   }
 

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerConcurrent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerConcurrent.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerConcurrent.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/TestSolrConfigHandlerConcurrent.java Tue Mar 31 05:22:40 2015
@@ -43,6 +43,7 @@ import org.apache.solr.common.cloud.DocC
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.core.ConfigOverlay;
 import org.apache.solr.util.RESTfulServerProvider;
 import org.apache.solr.util.RestTestHarness;
@@ -183,19 +184,19 @@ public class TestSolrConfigHandlerConcur
         Map m = (Map) respMap.get("overlay");
         if(m!= null) m = (Map) m.get("props");
         if(m == null) {
-          errmessages.add(MessageFormat.format( "overlay does not exist for cache: {0} , iteration: {1} response {2} ", cacheName, i, respMap.toString()));
+          errmessages.add(StrUtils.formatString("overlay does not exist for cache: {0} , iteration: {1} response {2} ", cacheName, i, respMap.toString()));
           continue;
         }
 
 
         Object o = getObjectByPath(m, true, asList("query", cacheName, "size"));
-        if(!val1.equals(o)) errmessages.add(MessageFormat.format("'size' property not set, expected = {0}, actual {1}", val1,o));
+        if(!val1.equals(o)) errmessages.add(StrUtils.formatString("'size' property not set, expected = {0}, actual {1}", val1, o));
 
         o = getObjectByPath(m, true, asList("query", cacheName, "initialSize"));
-        if(!val2.equals(o)) errmessages.add(MessageFormat.format("'initialSize' property not set, expected = {0}, actual {1}", val2,o));
+        if(!val2.equals(o)) errmessages.add(StrUtils.formatString("'initialSize' property not set, expected = {0}, actual {1}", val2, o));
 
         o = getObjectByPath(m, true, asList("query", cacheName, "autowarmCount"));
-        if(!val3.equals(o)) errmessages.add(MessageFormat.format("'autowarmCount' property not set, expected = {0}, actual {1}", val3,o));
+        if(!val3.equals(o)) errmessages.add(StrUtils.formatString("'autowarmCount' property not set, expected = {0}, actual {1}", val3, o));
         if(errmessages.isEmpty()) break;
       }
       if(!errmessages.isEmpty()) {

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java Tue Mar 31 05:22:40 2015
@@ -200,7 +200,7 @@ public class CoreAdminHandlerTest extend
     copySolrHomeToTemp(solrHomeDirectory, "corex", true);
     File corex = new File(solrHomeDirectory, "corex");
     FileUtils.write(new File(corex, "core.properties"), "", Charsets.UTF_8.toString());
-    JettySolrRunner runner = new JettySolrRunner(solrHomeDirectory.getAbsolutePath(), "/solr", 0, null, null, true, null, sslConfig);
+    JettySolrRunner runner = new JettySolrRunner(solrHomeDirectory.getAbsolutePath(), buildJettyConfig("/solr"));
     runner.start();
 
     try (HttpSolrClient client = new HttpSolrClient(runner.getBaseUrl() + "/corex")) {

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java Tue Mar 31 05:22:40 2015
@@ -42,10 +42,10 @@ public class ShowFileRequestHandlerTest
 
   @BeforeClass
   public static void beforeTest() throws Exception {
-    createJetty(legacyExampleCollection1SolrHome(), null, null);
+    createJetty(legacyExampleCollection1SolrHome());
   }
 
-  public void test404ViaHttp() throws SolrServerException {
+  public void test404ViaHttp() throws SolrServerException, IOException {
     SolrClient client = getSolrClient();
     QueryRequest request = new QueryRequest(params("file",
                                                    "does-not-exist-404.txt"));
@@ -80,7 +80,7 @@ public class ShowFileRequestHandlerTest
     }
   }
 
-  public void testDirList() throws SolrServerException {
+  public void testDirList() throws SolrServerException, IOException {
     SolrClient client = getSolrClient();
     //assertQ(req("qt", "/admin/file")); TODO file bug that SolrJettyTestBase extends SolrTestCaseJ4
     QueryRequest request = new QueryRequest();