lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romseyg...@apache.org
Subject [2/7] lucene-solr:branch_6x: SOLR-9634: Deprecate create/deleteCollection methods on MiniSolrCloudCluster
Date Tue, 18 Oct 2016 11:40:16 GMT
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
index f2064eb..0cae3c2 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
@@ -24,21 +24,20 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
-import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.SolrInputField;
-import org.apache.solr.common.SolrException;
 import org.apache.solr.common.ToleratedUpdateError;
 import org.apache.solr.common.ToleratedUpdateError.CmdType;
 import org.apache.solr.common.cloud.ClusterState;
@@ -49,10 +48,8 @@ import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
-
 import org.junit.Before;
 import org.junit.BeforeClass;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -103,7 +100,7 @@ public class TestTolerantUpdateProcessorCloud extends SolrCloudTestCase
{
   private static final String S_TWO_PRE = "XYZ!";
   
   @BeforeClass
-  private static void createMiniSolrCloudCluster() throws Exception {
+  public static void createMiniSolrCloudCluster() throws Exception {
     
     final String configName = "solrCloudCollectionConfig";
     final File configDir = new File(TEST_HOME() + File.separator + "collection1" + File.separator
+ "conf");
@@ -112,16 +109,14 @@ public class TestTolerantUpdateProcessorCloud extends SolrCloudTestCase
{
       .addConfig(configName, configDir.toPath())
       .configure();
     assertSpinLoopAllJettyAreRunning(cluster);
-    
-    Map<String, String> collectionProperties = new HashMap<>();
-    collectionProperties.put("config", "solrconfig-distrib-update-processor-chains.xml");
-    collectionProperties.put("schema", "schema15.xml"); // string id for doc routing prefix
 
-    assertNotNull(cluster.createCollection(COLLECTION_NAME, NUM_SHARDS, REPLICATION_FACTOR,
-                                           configName, null, null, collectionProperties));
-    
     CLOUD_CLIENT = cluster.getSolrClient();
     CLOUD_CLIENT.setDefaultCollection(COLLECTION_NAME);
+
+    CollectionAdminRequest.createCollection(COLLECTION_NAME, configName, NUM_SHARDS, REPLICATION_FACTOR)
+        .withProperty("config", "solrconfig-distrib-update-processor-chains.xml")
+        .withProperty("schema", "schema15.xml") // string id for doc routing prefix
+        .process(CLOUD_CLIENT);
     
     ZkStateReader zkStateReader = CLOUD_CLIENT.getZkStateReader();
     AbstractDistribZkTestBase.waitForRecoveriesToFinish(COLLECTION_NAME, zkStateReader, true,
true, 330);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java
b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java
index 85474f9..c399038 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.cloud;
 
+import javax.ws.rs.HEAD;
 import java.io.File;
 import java.lang.invoke.MethodHandles;
 import java.net.URL;
@@ -28,34 +29,34 @@ import java.util.Random;
 
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
-import org.apache.solr.cloud.SolrCloudTestCase;
-import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.assertUpdateTolerantErrors;
-import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.addErr;
-import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.delIErr;
-import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.delQErr;
-import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.f;
-import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.update;
-import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.ExpectedErr;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.UpdateResponse;
-import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_PARAM;
-import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_START;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.SolrInputField;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.params.SolrParams;
-
 import org.junit.Before;
 import org.junit.BeforeClass;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.ExpectedErr;
+import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.addErr;
+import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.assertUpdateTolerantErrors;
+import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.delIErr;
+import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.delQErr;
+import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.f;
+import static org.apache.solr.cloud.TestTolerantUpdateProcessorCloud.update;
+import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_PARAM;
+import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_START;
+
 /**
  * Test of TolerantUpdateProcessor using a randomized MiniSolrCloud.
  * Reuses some utility methods in {@link TestTolerantUpdateProcessorCloud}
@@ -77,10 +78,10 @@ public class TestTolerantUpdateProcessorRandomCloud extends SolrCloudTestCase
{
   /** A basic client for operations at the cloud level, default collection will be set */
   private static CloudSolrClient CLOUD_CLIENT;
   /** one HttpSolrClient for each server */
-  private static List<SolrClient> NODE_CLIENTS;
+  private static List<HttpSolrClient> NODE_CLIENTS;
 
   @BeforeClass
-  private static void createMiniSolrCloudCluster() throws Exception {
+  public static void createMiniSolrCloudCluster() throws Exception {
     
     final String configName = "solrCloudCollectionConfig";
     final File configDir = new File(TEST_HOME() + File.separator + "collection1" + File.separator
+ "conf");
@@ -101,15 +102,20 @@ public class TestTolerantUpdateProcessorRandomCloud extends SolrCloudTestCase
{
     collectionProperties.put("config", "solrconfig-distrib-update-processor-chains.xml");
     collectionProperties.put("schema", "schema15.xml"); // string id 
 
-
-    assertNotNull(cluster.createCollection(COLLECTION_NAME, numShards, repFactor,
-                                           configName, null, null, collectionProperties));
-    
     CLOUD_CLIENT = cluster.getSolrClient();
     CLOUD_CLIENT.setDefaultCollection(COLLECTION_NAME);
 
-    NODE_CLIENTS = new ArrayList<SolrClient>(numServers);
-    
+    CollectionAdminRequest.createCollection(COLLECTION_NAME, configName, numShards, repFactor)
+        .setProperties(collectionProperties)
+        .process(CLOUD_CLIENT);
+
+    if (NODE_CLIENTS != null) {
+      for (HttpSolrClient client : NODE_CLIENTS) {
+        client.close();
+      }
+    }
+    NODE_CLIENTS = new ArrayList<HttpSolrClient>(numServers);
+
     for (JettySolrRunner jetty : cluster.getJettySolrRunners()) {
       URL jettyURL = jetty.getBaseUrl();
       NODE_CLIENTS.add(getHttpSolrClient(jettyURL.toString() + "/" + COLLECTION_NAME + "/"));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/core/BlobRepositoryCloudTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/BlobRepositoryCloudTest.java b/solr/core/src/test/org/apache/solr/core/BlobRepositoryCloudTest.java
index 40f5792..ad3c8db 100644
--- a/solr/core/src/test/org/apache/solr/core/BlobRepositoryCloudTest.java
+++ b/solr/core/src/test/org/apache/solr/core/BlobRepositoryCloudTest.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.SolrDocumentList;
@@ -45,14 +46,17 @@ public class BlobRepositoryCloudTest extends SolrCloudTestCase {
         .configure();
 //    Thread.sleep(2000);
     HashMap<String, String> params = new HashMap<>();
-    cluster.createCollection(".system", 1, 1, null, params);
+    CollectionAdminRequest.createCollection(".system", null, 1, 1)
+        .process(cluster.getSolrClient());
     // test component will fail if it cant' find a blob with this data by this name
     TestBlobHandler.postData(cluster.getSolrClient(), findLiveNodeURI(), "testResource",
ByteBuffer.wrap("foo,bar\nbaz,bam".getBytes(StandardCharsets.UTF_8)));
     //    Thread.sleep(2000);
     // if these don't load we probably failed to post the blob above
-    cluster.createCollection("col1", 1, 1, "configname", params);
-    cluster.createCollection("col2", 1, 1, "configname", params);
-//    Thread.sleep(2000);
+    CollectionAdminRequest.createCollection("col1", "configname", 1, 1)
+        .process(cluster.getSolrClient());
+    CollectionAdminRequest.createCollection("col2", "configname", 1, 1)
+        .process(cluster.getSolrClient());
+
     SolrInputDocument document = new SolrInputDocument();
     document.addField("id", "1");
     document.addField("text", "col1");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
index b95a5f6..96a01c3 100644
--- a/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
@@ -24,6 +24,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.SolrPing;
 import org.apache.solr.client.solrj.response.SolrPingResponse;
 import org.apache.solr.cloud.MiniSolrCloudCluster;
@@ -189,10 +190,10 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
       // create collection
       String collectionName = "testSolrCloudCollection";
       String configName = "solrCloudCollectionConfig";
-      File configDir = new File(SolrTestCaseJ4.TEST_HOME() + File.separator + "collection1"
+ File.separator + "conf");
-      miniCluster.uploadConfigDir(configDir, configName);
-      miniCluster.createCollection(collectionName, NUM_SHARDS, REPLICATION_FACTOR, configName,
null); 
-   
+      miniCluster.uploadConfigSet(SolrTestCaseJ4.TEST_PATH().resolve("collection1").resolve("conf"),
configName);
+      CollectionAdminRequest.createCollection(collectionName, configName, NUM_SHARDS, REPLICATION_FACTOR)
+          .process(miniCluster.getSolrClient());
+
       // Send distributed and non-distributed ping query
       SolrPingWithDistrib reqDistrib = new SolrPingWithDistrib();
       reqDistrib.setDistrib(true);
@@ -206,9 +207,6 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
       assertEquals(0, rsp.getStatus());   
       assertTrue(rsp.getResponseHeader().getBooleanArg(("zkConnected")));
 
-      // delete the collection we created earlier
-      miniCluster.deleteCollection(collectionName);
-
     }
     finally {
       miniCluster.shutdown();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/handler/TestReqParamsAPI.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/TestReqParamsAPI.java b/solr/core/src/test/org/apache/solr/handler/TestReqParamsAPI.java
index 5c2f67d..d594e48 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestReqParamsAPI.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestReqParamsAPI.java
@@ -24,6 +24,7 @@ import java.util.function.Predicate;
 
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.cloud.DocCollection;
@@ -57,7 +58,8 @@ public class TestReqParamsAPI extends SolrCloudTestCase {
     configureCluster(2)
         .addConfig("conf1", TEST_PATH().resolve("configsets").resolve("cloud-managed").resolve("conf"))
         .configure();
-    cluster.createCollection(COLL_NAME, 1, 2, "conf1", null);
+    CollectionAdminRequest.createCollection(COLL_NAME, "conf1", 1, 2)
+        .process(cluster.getSolrClient());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/handler/component/SearchHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/SearchHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/component/SearchHandlerTest.java
index 70744e2..7501651 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/SearchHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/SearchHandlerTest.java
@@ -16,13 +16,13 @@
  */
 package org.apache.solr.handler.component;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.cloud.MiniSolrCloudCluster;
@@ -122,19 +122,14 @@ public class SearchHandlerTest extends SolrTestCaseJ4
       // create collection
       String collectionName = "testSolrCloudCollection";
       String configName = "solrCloudCollectionConfig";
-      File configDir = new File(SolrTestCaseJ4.TEST_HOME() + File.separator + "collection1"
+ File.separator + "conf");
-      miniCluster.uploadConfigDir(configDir, configName);
-      miniCluster.createCollection(collectionName, 2, 2, configName, null); 
-   
-      
+      miniCluster.uploadConfigSet(SolrTestCaseJ4.TEST_PATH().resolve("collection1/conf"),
configName);
+
+      CollectionAdminRequest.createCollection(collectionName, configName, 2, 2)
+          .process(miniCluster.getSolrClient());
     
       QueryRequest req = new QueryRequest();
       QueryResponse rsp = req.process(cloudSolrClient, collectionName);
       assertTrue(rsp.getResponseHeader().getBooleanArg("zkConnected"));
-    
-      
-      // delete the collection we created earlier
-      miniCluster.deleteCollection(collectionName);
 
     }
     finally {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/response/transform/TestSubQueryTransformerDistrib.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/response/transform/TestSubQueryTransformerDistrib.java
b/solr/core/src/test/org/apache/solr/response/transform/TestSubQueryTransformerDistrib.java
index 0273a85..c417272 100644
--- a/solr/core/src/test/org/apache/solr/response/transform/TestSubQueryTransformerDistrib.java
+++ b/solr/core/src/test/org/apache/solr/response/transform/TestSubQueryTransformerDistrib.java
@@ -29,6 +29,7 @@ import java.util.Random;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest;
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
@@ -64,13 +65,16 @@ public class TestSubQueryTransformerDistrib extends SolrCloudTestCase
{
 
     int shards = 2;
     int replicas = 2 ;
-    assertNotNull(cluster.createCollection(people, shards, replicas,
-        configName,
-        collectionProperties));
-    
-    assertNotNull(cluster.createCollection(depts, shards, replicas,
-        configName, collectionProperties));
-    
+    CollectionAdminRequest.createCollection(people, configName, shards, replicas)
+        .withProperty("config", "solrconfig-doctransformers.xml")
+        .withProperty("schema", "schema-docValuesJoin.xml")
+        .process(cluster.getSolrClient());
+
+    CollectionAdminRequest.createCollection(depts, configName, shards, replicas)
+        .withProperty("config", "solrconfig-doctransformers.xml")
+        .withProperty("schema", "schema-docValuesJoin.xml")
+        .process(cluster.getSolrClient());
+
     CloudSolrClient client = cluster.getSolrClient();
     client.setDefaultCollection(people);
     

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java
index e426e3b..14f1525 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java
@@ -50,7 +50,8 @@ public class TestManagedSchemaAPI extends SolrCloudTestCase {
   @Test
   public void test() throws Exception {
     String collection = "testschemaapi";
-    cluster.createCollection(collection, 1, 2, "conf1", null);
+    CollectionAdminRequest.createCollection(collection, "conf1", 1, 2)
+        .process(cluster.getSolrClient());
     testReloadAndAddSimple(collection);
     testAddFieldAndDocument(collection);
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetDistribTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetDistribTest.java
b/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetDistribTest.java
index 70f95a7..2bd30fa 100644
--- a/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetDistribTest.java
+++ b/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetDistribTest.java
@@ -30,10 +30,10 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.response.FacetField;
 import org.apache.solr.client.solrj.response.FacetField.Count;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.cloud.AbstractDistribZkTestBase;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.ModifiableSolrParams;
@@ -64,13 +64,10 @@ public class BlockJoinFacetDistribTest extends SolrCloudTestCase{
     
     int shards = 3;
     int replicas = 2 ;
-    assertNotNull(cluster.createCollection(collection, shards, replicas,
-        configName,
-        collectionProperties));
-    
-    AbstractDistribZkTestBase.waitForRecoveriesToFinish(collection, 
-        cluster.getSolrClient().getZkStateReader(), false, true, 30);
-   
+    CollectionAdminRequest.createCollection(collection, configName, shards, replicas)
+        .setProperties(collectionProperties)
+        .process(cluster.getSolrClient());
+
   }
 
   final static List<String> colors = Arrays.asList("red","blue","brown","white","black","yellow","cyan","magenta","blur",

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
index acb5225..b4fad72 100644
--- a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
+++ b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
@@ -16,7 +16,6 @@
  */
 package org.apache.solr.search.stats;
 
-import java.io.File;
 import java.io.IOException;
 import java.lang.invoke.MethodHandles;
 
@@ -59,10 +58,8 @@ public class TestDistribIDF extends SolrTestCaseJ4 {
     // set some system properties for use by tests
     System.setProperty("solr.test.sys.prop1", "propone");
     System.setProperty("solr.test.sys.prop2", "proptwo");
-    File configDir = getFile("solr").toPath().resolve("collection1/conf").toFile();
-    solrCluster.uploadConfigDir(configDir, "conf1");
-    configDir = getFile("solr").toPath().resolve("configsets/configset-2/conf").toFile();
-    solrCluster.uploadConfigDir(configDir, "conf2");
+    solrCluster.uploadConfigSet(TEST_PATH().resolve("collection1/conf"), "conf1");
+    solrCluster.uploadConfigSet(configset("configset-2"), "conf2");
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
index af5d74b..c1f8261 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
@@ -18,6 +18,7 @@ package org.apache.solr.client.solrj.request;
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Map;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.UUID;
@@ -460,6 +461,19 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
       return this;
     }
 
+    public Create setProperties(Map<String, String> properties) {
+      this.properties = new Properties();
+      this.properties.putAll(properties);
+      return this;
+    }
+
+    public Create withProperty(String key, String value) {
+      if (this.properties == null)
+        this.properties = new Properties();
+      this.properties.setProperty(key, value);
+      return this;
+    }
+
     @Override
     public SolrParams getParams() {
       ModifiableSolrParams params = (ModifiableSolrParams) super.getParams();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
index fca0e35..d8a1f0f 100644
--- a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
+++ b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java
@@ -18,7 +18,6 @@
 package org.apache.solr.common.cloud;
 
 import java.lang.invoke.MethodHandles;
-import java.util.HashMap;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
@@ -269,7 +268,8 @@ public class TestCollectionStateWatchers extends SolrCloudTestCase {
 
   @Test
   public void testDeletionsTriggerWatches() throws Exception {
-    cluster.createCollection("tobedeleted", 1, 1, "config", new HashMap<>());
+    CollectionAdminRequest.createCollection("tobedeleted", "config", 1, 1)
+        .process(cluster.getSolrClient());
     Future<Boolean> future = waitInBackground("tobedeleted", MAX_WAIT_TIMEOUT, TimeUnit.SECONDS,
(l, c) -> c == null);
 
     CollectionAdminRequest.deleteCollection("tobedeleted").process(cluster.getSolrClient());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df09867c/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index 7e809c7..9301fd0 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -393,12 +393,25 @@ public class MiniSolrCloudCluster {
     jetty.stop();
     return jetty;
   }
-  
+
+  /**
+   * @deprecated Use {@link #uploadConfigSet(Path, String)}
+   */
+  @Deprecated
   public void uploadConfigDir(File configDir, String configName) throws IOException, KeeperException,
InterruptedException {
+    uploadConfigSet(configDir.toPath(), configName);
+  }
+
+  /**
+   * Upload a config set
+   * @param configDir a path to the config set to upload
+   * @param configName the name to give the configset
+   */
+  public void uploadConfigSet(Path configDir, String configName) throws IOException, KeeperException,
InterruptedException {
     try(SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(),
         AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT, null)) {
       ZkConfigManager manager = new ZkConfigManager(zkClient);
-      manager.uploadConfigDir(configDir.toPath(), configName);
+      manager.uploadConfigDir(configDir, configName);
     }
   }
 
@@ -410,13 +423,21 @@ public class MiniSolrCloudCluster {
       }
     }
   }
-  
-  public NamedList<Object> createCollection(String name, int numShards, int replicationFactor,

+
+  /**
+   * @deprecated Use {@link CollectionAdminRequest#createCollection(String, String, int,
int)}
+   */
+  @Deprecated
+  public NamedList<Object> createCollection(String name, int numShards, int replicationFactor,
       String configName, Map<String, String> collectionProperties) throws SolrServerException,
IOException {
     return createCollection(name, numShards, replicationFactor, configName, null, null, collectionProperties);
   }
 
-  public NamedList<Object> createCollection(String name, int numShards, int replicationFactor,

+  /**
+   * @deprecated Use {@link CollectionAdminRequest#createCollection(String, String, int,
int)}
+   */
+  @Deprecated
+  public NamedList<Object> createCollection(String name, int numShards, int replicationFactor,
       String configName, String createNodeSet, String asyncId, Map<String, String>
collectionProperties) throws SolrServerException, IOException {
     final ModifiableSolrParams params = new ModifiableSolrParams();
     params.set(CoreAdminParams.ACTION, CollectionAction.CREATE.name());
@@ -439,6 +460,10 @@ public class MiniSolrCloudCluster {
     return makeCollectionsRequest(params);
   }
 
+  /**
+   * @deprecated use {@link CollectionAdminRequest#deleteCollection(String)}
+   */
+  @Deprecated
   public NamedList<Object> deleteCollection(String name) throws SolrServerException,
IOException {
     final ModifiableSolrParams params = new ModifiableSolrParams();
     params.set(CoreAdminParams.ACTION, CollectionAction.DELETE.name());


Mime
View raw message