mirror of https://github.com/apache/lucene.git
refactor method names
This commit is contained in:
parent
67ecd8ff9a
commit
e826b1f344
|
@ -37,7 +37,6 @@ import java.util.stream.Collectors;
|
||||||
import org.apache.commons.collections4.MultiValuedMap;
|
import org.apache.commons.collections4.MultiValuedMap;
|
||||||
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
|
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
|
||||||
import org.apache.http.client.methods.HttpDelete;
|
import org.apache.http.client.methods.HttpDelete;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||||
import org.apache.solr.client.solrj.request.V2Request;
|
import org.apache.solr.client.solrj.request.V2Request;
|
||||||
|
@ -129,7 +128,7 @@ public class PackageManager implements Closeable {
|
||||||
|
|
||||||
V2Request req = new V2Request.Builder(PackageUtils.PACKAGE_PATH)
|
V2Request req = new V2Request.Builder(PackageUtils.PACKAGE_PATH)
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Collections.singletonMap("delete", del))
|
.withPayload(Collections.singletonMap("delete", del))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.lucene.util.SuppressForbidden;
|
import org.apache.lucene.util.SuppressForbidden;
|
||||||
import org.apache.solr.client.solrj.SolrClient;
|
import org.apache.solr.client.solrj.SolrClient;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||||
import org.apache.solr.client.solrj.request.V2Request;
|
import org.apache.solr.client.solrj.request.V2Request;
|
||||||
|
@ -96,7 +95,7 @@ public class PackageUtils {
|
||||||
params.add("sig", sig);
|
params.add("sig", sig);
|
||||||
}
|
}
|
||||||
V2Response rsp = new V2Request.Builder(resource)
|
V2Response rsp = new V2Request.Builder(resource)
|
||||||
.withMethod(SolrRequest.METHOD.PUT)
|
.PUT()
|
||||||
.withPayload(buffer)
|
.withPayload(buffer)
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMimeType("application/octet-stream")
|
.withMimeType("application/octet-stream")
|
||||||
|
|
|
@ -38,7 +38,6 @@ import java.util.stream.Collectors;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.lucene.util.Version;
|
import org.apache.lucene.util.Version;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||||
import org.apache.solr.client.solrj.request.V2Request;
|
import org.apache.solr.client.solrj.request.V2Request;
|
||||||
|
@ -207,7 +206,7 @@ public class RepositoryManager {
|
||||||
|
|
||||||
V2Request req = new V2Request.Builder(PackageUtils.PACKAGE_PATH)
|
V2Request req = new V2Request.Builder(PackageUtils.PACKAGE_PATH)
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Collections.singletonMap("add", add))
|
.withPayload(Collections.singletonMap("add", add))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
|
@ -708,7 +707,7 @@ public class AliasIntegrationTest extends SolrCloudTestCase {
|
||||||
///////////////
|
///////////////
|
||||||
// use v2 API
|
// use v2 API
|
||||||
new V2Request.Builder("/collections")
|
new V2Request.Builder("/collections")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{\"create-alias\": {\"name\": \"testalias6\", collections:[\"collection2\",\"collection1\"]}}")
|
.withPayload("{\"create-alias\": {\"name\": \"testalias6\", collections:[\"collection2\",\"collection1\"]}}")
|
||||||
.build().process(cluster.getSolrClient());
|
.build().process(cluster.getSolrClient());
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ import com.google.common.collect.ImmutableList;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.TestUtil;
|
import org.apache.lucene.util.TestUtil;
|
||||||
import org.apache.solr.client.solrj.SolrClient;
|
import org.apache.solr.client.solrj.SolrClient;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||||
|
@ -134,7 +133,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
String COLL_NAME = "CollWithDefaultClusterProperties";
|
String COLL_NAME = "CollWithDefaultClusterProperties";
|
||||||
try {
|
try {
|
||||||
V2Response rsp = new V2Request.Builder("/cluster")
|
V2Response rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{set-obj-property:{collectionDefaults:{numShards : 2 , nrtReplicas : 2}}}")
|
.withPayload("{set-obj-property:{collectionDefaults:{numShards : 2 , nrtReplicas : 2}}}")
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
|
@ -167,7 +166,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
// unset only a single value using old format
|
// unset only a single value using old format
|
||||||
rsp = new V2Request.Builder("/cluster")
|
rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{\n" +
|
.withPayload("{\n" +
|
||||||
" \"set-obj-property\": {\n" +
|
" \"set-obj-property\": {\n" +
|
||||||
" \"collectionDefaults\": {\n" +
|
" \"collectionDefaults\": {\n" +
|
||||||
|
@ -190,7 +189,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
// delete all defaults the old way
|
// delete all defaults the old way
|
||||||
rsp = new V2Request.Builder("/cluster")
|
rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{set-obj-property:{collectionDefaults:null}}")
|
.withPayload("{set-obj-property:{collectionDefaults:null}}")
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
|
@ -206,7 +205,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
} finally {
|
} finally {
|
||||||
// clean up in case there was an exception during the test
|
// clean up in case there was an exception during the test
|
||||||
V2Response rsp = new V2Request.Builder("/cluster")
|
V2Response rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{set-obj-property:{collectionDefaults: null}}")
|
.withPayload("{set-obj-property:{collectionDefaults: null}}")
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
|
@ -219,7 +218,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
String COLL_NAME = "CollWithDefaultClusterProperties";
|
String COLL_NAME = "CollWithDefaultClusterProperties";
|
||||||
try {
|
try {
|
||||||
V2Response rsp = new V2Request.Builder("/cluster")
|
V2Response rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{set-obj-property:{defaults : {collection:{numShards : 2 , nrtReplicas : 2}}}}")
|
.withPayload("{set-obj-property:{defaults : {collection:{numShards : 2 , nrtReplicas : 2}}}}")
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
|
@ -251,7 +250,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
// unset only a single value
|
// unset only a single value
|
||||||
rsp = new V2Request.Builder("/cluster")
|
rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{\n" +
|
.withPayload("{\n" +
|
||||||
" \"set-obj-property\": {\n" +
|
" \"set-obj-property\": {\n" +
|
||||||
" \"defaults\" : {\n" +
|
" \"defaults\" : {\n" +
|
||||||
|
@ -272,7 +271,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
assertNull(clusterProperty);
|
assertNull(clusterProperty);
|
||||||
|
|
||||||
rsp = new V2Request.Builder("/cluster")
|
rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{set-obj-property:{defaults: {collection:null}}}")
|
.withPayload("{set-obj-property:{defaults: {collection:null}}}")
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
|
@ -287,7 +286,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
||||||
assertNull(clusterProperty);
|
assertNull(clusterProperty);
|
||||||
} finally {
|
} finally {
|
||||||
V2Response rsp = new V2Request.Builder("/cluster")
|
V2Response rsp = new V2Request.Builder("/cluster")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{set-obj-property:{defaults: null}}")
|
.withPayload("{set-obj-property:{defaults: null}}")
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class TestDistribPackageStore extends SolrCloudTestCase {
|
||||||
assertResponseValues(10,
|
assertResponseValues(10,
|
||||||
cluster.getSolrClient(),
|
cluster.getSolrClient(),
|
||||||
new V2Request.Builder("/node/files/package/mypkg/v1.0")
|
new V2Request.Builder("/node/files/package/mypkg/v1.0")
|
||||||
.withMethod(SolrRequest.METHOD.GET)
|
.GET()
|
||||||
.build(),
|
.build(),
|
||||||
Utils.makeMap(
|
Utils.makeMap(
|
||||||
":files:/package/mypkg/v1.0[0]:name", "runtimelibs.jar",
|
":files:/package/mypkg/v1.0[0]:name", "runtimelibs.jar",
|
||||||
|
@ -113,7 +113,7 @@ public class TestDistribPackageStore extends SolrCloudTestCase {
|
||||||
assertResponseValues(10,
|
assertResponseValues(10,
|
||||||
cluster.getSolrClient(),
|
cluster.getSolrClient(),
|
||||||
new V2Request.Builder("/node/files/package/mypkg")
|
new V2Request.Builder("/node/files/package/mypkg")
|
||||||
.withMethod(SolrRequest.METHOD.GET)
|
.GET()
|
||||||
.build(),
|
.build(),
|
||||||
Utils.makeMap(
|
Utils.makeMap(
|
||||||
":files:/package/mypkg[0]:name", "v1.0",
|
":files:/package/mypkg[0]:name", "v1.0",
|
||||||
|
@ -278,7 +278,7 @@ public class TestDistribPackageStore extends SolrCloudTestCase {
|
||||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
ModifiableSolrParams params = new ModifiableSolrParams();
|
||||||
params.add("sig", sig);
|
params.add("sig", sig);
|
||||||
V2Response rsp = new V2Request.Builder(resource)
|
V2Response rsp = new V2Request.Builder(resource)
|
||||||
.withMethod(SolrRequest.METHOD.PUT)
|
.PUT()
|
||||||
.withPayload(buffer)
|
.withPayload(buffer)
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMimeType("application/octet-stream")
|
.withMimeType("application/octet-stream")
|
||||||
|
|
|
@ -58,7 +58,6 @@ import org.junit.Test;
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
|
import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
|
||||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.POST;
|
|
||||||
import static org.apache.solr.filestore.TestDistribPackageStore.readFile;
|
import static org.apache.solr.filestore.TestDistribPackageStore.readFile;
|
||||||
import static org.apache.solr.filestore.TestDistribPackageStore.uploadKey;
|
import static org.apache.solr.filestore.TestDistribPackageStore.uploadKey;
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
//test with an invalid class
|
//test with an invalid class
|
||||||
V2Request req = new V2Request.Builder("/cluster/plugin")
|
V2Request req = new V2Request.Builder("/cluster/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(POST)
|
.POST()
|
||||||
.withPayload(singletonMap("add", plugin))
|
.withPayload(singletonMap("add", plugin))
|
||||||
.build();
|
.build();
|
||||||
expectError(req, cluster.getSolrClient(), errPath, "No method with @Command in class");
|
expectError(req, cluster.getSolrClient(), errPath, "No method with @Command in class");
|
||||||
|
@ -107,7 +106,7 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
//just check if the plugin is indeed registered
|
//just check if the plugin is indeed registered
|
||||||
V2Request readPluginState = new V2Request.Builder("/cluster/plugin")
|
V2Request readPluginState = new V2Request.Builder("/cluster/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
V2Response rsp = readPluginState.process(cluster.getSolrClient());
|
V2Response rsp = readPluginState.process(cluster.getSolrClient());
|
||||||
assertEquals(C3.class.getName(), rsp._getStr("/plugin/testplugin/class", null));
|
assertEquals(C3.class.getName(), rsp._getStr("/plugin/testplugin/class", null));
|
||||||
|
@ -116,13 +115,13 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/plugin/my/plugin")
|
() -> new V2Request.Builder("/plugin/my/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
ImmutableMap.of("/testkey", "testval"));
|
ImmutableMap.of("/testkey", "testval"));
|
||||||
|
|
||||||
//now remove the plugin
|
//now remove the plugin
|
||||||
new V2Request.Builder("/cluster/plugin")
|
new V2Request.Builder("/cluster/plugin")
|
||||||
.withMethod(POST)
|
.POST()
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withPayload("{remove : testplugin}")
|
.withPayload("{remove : testplugin}")
|
||||||
.build()
|
.build()
|
||||||
|
@ -147,19 +146,19 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/my-random-name/my/plugin")
|
() -> new V2Request.Builder("/my-random-name/my/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
ImmutableMap.of("/method.name", "m1"));
|
ImmutableMap.of("/method.name", "m1"));
|
||||||
|
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/my-random-prefix/their/plugin")
|
() -> new V2Request.Builder("/my-random-prefix/their/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
ImmutableMap.of("/method.name", "m2"));
|
ImmutableMap.of("/method.name", "m2"));
|
||||||
//now remove the plugin
|
//now remove the plugin
|
||||||
new V2Request.Builder("/cluster/plugin")
|
new V2Request.Builder("/cluster/plugin")
|
||||||
.withMethod(POST)
|
.POST()
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withPayload("{remove : my-random-name}")
|
.withPayload("{remove : my-random-name}")
|
||||||
.build()
|
.build()
|
||||||
|
@ -167,12 +166,12 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
|
|
||||||
expectFail( () -> new V2Request.Builder("/my-random-prefix/their/plugin")
|
expectFail( () -> new V2Request.Builder("/my-random-prefix/their/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient()));
|
.process(cluster.getSolrClient()));
|
||||||
expectFail(() -> new V2Request.Builder("/my-random-prefix/their/plugin")
|
expectFail(() -> new V2Request.Builder("/my-random-prefix/their/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient()));
|
.process(cluster.getSolrClient()));
|
||||||
|
|
||||||
|
@ -184,7 +183,7 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
//just check if the plugin is indeed registered
|
//just check if the plugin is indeed registered
|
||||||
readPluginState = new V2Request.Builder("/cluster/plugin")
|
readPluginState = new V2Request.Builder("/cluster/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
rsp = readPluginState.process(cluster.getSolrClient());
|
rsp = readPluginState.process(cluster.getSolrClient());
|
||||||
assertEquals(C6.class.getName(), rsp._getStr("/plugin/clusterSingleton/class", null));
|
assertEquals(C6.class.getName(), rsp._getStr("/plugin/clusterSingleton/class", null));
|
||||||
|
@ -241,7 +240,7 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
add.files = singletonList(FILE1);
|
add.files = singletonList(FILE1);
|
||||||
V2Request addPkgVersionReq = new V2Request.Builder("/cluster/package")
|
V2Request addPkgVersionReq = new V2Request.Builder("/cluster/package")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(POST)
|
.POST()
|
||||||
.withPayload(singletonMap("add", add))
|
.withPayload(singletonMap("add", add))
|
||||||
.build();
|
.build();
|
||||||
addPkgVersionReq.process(cluster.getSolrClient());
|
addPkgVersionReq.process(cluster.getSolrClient());
|
||||||
|
@ -258,14 +257,14 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
plugin.version = add.version;
|
plugin.version = add.version;
|
||||||
final V2Request req1 = new V2Request.Builder("/cluster/plugin")
|
final V2Request req1 = new V2Request.Builder("/cluster/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(POST)
|
.POST()
|
||||||
.withPayload(singletonMap("add", plugin))
|
.withPayload(singletonMap("add", plugin))
|
||||||
.build();
|
.build();
|
||||||
req1.process(cluster.getSolrClient());
|
req1.process(cluster.getSolrClient());
|
||||||
//verify the plugin creation
|
//verify the plugin creation
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/cluster/plugin").
|
() -> new V2Request.Builder("/cluster/plugin")
|
||||||
withMethod(GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
"/plugin/myplugin/class", plugin.klass,
|
"/plugin/myplugin/class", plugin.klass,
|
||||||
|
@ -274,7 +273,7 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
//let's test this now
|
//let's test this now
|
||||||
Callable<NavigableObject> invokePlugin = () -> new V2Request.Builder("/plugin/my/path")
|
Callable<NavigableObject> invokePlugin = () -> new V2Request.Builder("/plugin/my/path")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient());
|
.build().process(cluster.getSolrClient());
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
invokePlugin,
|
invokePlugin,
|
||||||
|
@ -289,15 +288,15 @@ public class TestContainerPlugin extends SolrCloudTestCase {
|
||||||
plugin.version = add.version;
|
plugin.version = add.version;
|
||||||
new V2Request.Builder("/cluster/plugin")
|
new V2Request.Builder("/cluster/plugin")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(POST)
|
.GET()
|
||||||
.withPayload(singletonMap("update", plugin))
|
.withPayload(singletonMap("update", plugin))
|
||||||
.build()
|
.build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
|
|
||||||
//now verify if it is indeed updated
|
//now verify if it is indeed updated
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/cluster/plugin").
|
() -> new V2Request.Builder("/cluster/plugin")
|
||||||
withMethod(GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
"/plugin/myplugin/class", plugin.klass,
|
"/plugin/myplugin/class", plugin.klass,
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
package org.apache.solr.handler;
|
package org.apache.solr.handler;
|
||||||
|
|
||||||
import org.apache.solr.client.solrj.ResponseParser;
|
import org.apache.solr.client.solrj.ResponseParser;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.impl.*;
|
import org.apache.solr.client.solrj.impl.*;
|
||||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||||
|
@ -63,7 +62,7 @@ public class V2ApiIntegrationTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
private void testException(ResponseParser responseParser, int expectedCode, String path, String payload) throws IOException, SolrServerException {
|
private void testException(ResponseParser responseParser, int expectedCode, String path, String payload) throws IOException, SolrServerException {
|
||||||
V2Request v2Request = new V2Request.Builder(path)
|
V2Request v2Request = new V2Request.Builder(path)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(payload)
|
.withPayload(payload)
|
||||||
.build();
|
.build();
|
||||||
v2Request.setResponseParser(responseParser);
|
v2Request.setResponseParser(responseParser);
|
||||||
|
@ -150,10 +149,12 @@ public class V2ApiIntegrationTest extends SolrCloudTestCase {
|
||||||
public void testSetPropertyValidationOfCluster() throws IOException, SolrServerException {
|
public void testSetPropertyValidationOfCluster() throws IOException, SolrServerException {
|
||||||
@SuppressWarnings({"rawtypes"})
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList resp = cluster.getSolrClient().request(
|
NamedList resp = cluster.getSolrClient().request(
|
||||||
new V2Request.Builder("/cluster").withMethod(SolrRequest.METHOD.POST).withPayload("{set-property: {name: maxCoresPerNode, val:42}}").build());
|
new V2Request.Builder("/cluster")
|
||||||
|
.POST()
|
||||||
|
.withPayload("{set-property: {name: maxCoresPerNode, val:42}}").build());
|
||||||
assertTrue(resp.toString().contains("status=0"));
|
assertTrue(resp.toString().contains("status=0"));
|
||||||
resp = cluster.getSolrClient().request(
|
resp = cluster.getSolrClient().request(
|
||||||
new V2Request.Builder("/cluster").withMethod(SolrRequest.METHOD.POST).withPayload("{set-property: {name: maxCoresPerNode, val:null}}").build());
|
new V2Request.Builder("/cluster").POST().withPayload("{set-property: {name: maxCoresPerNode, val:null}}").build());
|
||||||
assertTrue(resp.toString().contains("status=0"));
|
assertTrue(resp.toString().contains("status=0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ public class V2ApiIntegrationTest extends SolrCloudTestCase {
|
||||||
backupParams.put("location", tempDir);
|
backupParams.put("location", tempDir);
|
||||||
cluster.getJettySolrRunners().forEach(j -> j.getCoreContainer().getAllowPaths().add(Paths.get(tempDir)));
|
cluster.getJettySolrRunners().forEach(j -> j.getCoreContainer().getAllowPaths().add(Paths.get(tempDir)));
|
||||||
client.request(new V2Request.Builder("/c")
|
client.request(new V2Request.Builder("/c")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Utils.toJSONString(backupPayload))
|
.withPayload(Utils.toJSONString(backupPayload))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
add.files = Arrays.asList(new String[]{FILE1, URP1, EXPR1});
|
add.files = Arrays.asList(new String[]{FILE1, URP1, EXPR1});
|
||||||
V2Request req = new V2Request.Builder("/cluster/package")
|
V2Request req = new V2Request.Builder("/cluster/package")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Collections.singletonMap("add", add))
|
.withPayload(Collections.singletonMap("add", add))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
cluster.waitForActiveCollection(COLLECTION_NAME, 2, 4);
|
cluster.waitForActiveCollection(COLLECTION_NAME, 2, 4);
|
||||||
|
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/cluster/package").
|
() -> new V2Request.Builder("/cluster/package")
|
||||||
withMethod(SolrRequest.METHOD.GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
Utils.makeMap(
|
Utils.makeMap(
|
||||||
":result:packages:mypkg[0]:version", "1.0",
|
":result:packages:mypkg[0]:version", "1.0",
|
||||||
|
@ -183,7 +183,7 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
|
|
||||||
|
|
||||||
V2Request v2r = new V2Request.Builder( "/c/"+COLLECTION_NAME+ "/config")
|
V2Request v2r = new V2Request.Builder( "/c/"+COLLECTION_NAME+ "/config")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(plugins)
|
.withPayload(plugins)
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.build();
|
.build();
|
||||||
|
@ -319,7 +319,7 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
delVersion.pkg = "mypkg";
|
delVersion.pkg = "mypkg";
|
||||||
delVersion.version = "1.0";
|
delVersion.version = "1.0";
|
||||||
V2Request delete = new V2Request.Builder("/cluster/package")
|
V2Request delete = new V2Request.Builder("/cluster/package")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withPayload(Collections.singletonMap("delete", delVersion))
|
.withPayload(Collections.singletonMap("delete", delVersion))
|
||||||
.build();
|
.build();
|
||||||
|
@ -393,7 +393,7 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
//now, let's force every collection using 'mypkg' to refresh
|
//now, let's force every collection using 'mypkg' to refresh
|
||||||
//so that it uses version 2.1
|
//so that it uses version 2.1
|
||||||
new V2Request.Builder("/cluster/package")
|
new V2Request.Builder("/cluster/package")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{refresh : mypkg}")
|
.withPayload("{refresh : mypkg}")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.build()
|
.build()
|
||||||
|
@ -424,7 +424,7 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
plugins.put("create-queryparser", p);
|
plugins.put("create-queryparser", p);
|
||||||
|
|
||||||
v2r = new V2Request.Builder( "/c/"+COLLECTION_NAME+ "/config")
|
v2r = new V2Request.Builder( "/c/"+COLLECTION_NAME+ "/config")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(plugins)
|
.withPayload(plugins)
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.build();
|
.build();
|
||||||
|
@ -500,7 +500,7 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
add.files = Arrays.asList(new String[]{FILE1, FILE2});
|
add.files = Arrays.asList(new String[]{FILE1, FILE2});
|
||||||
V2Request req = new V2Request.Builder("/cluster/package")
|
V2Request req = new V2Request.Builder("/cluster/package")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Collections.singletonMap("add", add))
|
.withPayload(Collections.singletonMap("add", add))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
delVersion.pkg = "test_pkg";
|
delVersion.pkg = "test_pkg";
|
||||||
req = new V2Request.Builder("/cluster/package")
|
req = new V2Request.Builder("/cluster/package")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Collections.singletonMap("delete", delVersion))
|
.withPayload(Collections.singletonMap("delete", delVersion))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -669,14 +669,14 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
add.files = Arrays.asList(FILE1,FILE2);
|
add.files = Arrays.asList(FILE1,FILE2);
|
||||||
V2Request req = new V2Request.Builder("/cluster/package")
|
V2Request req = new V2Request.Builder("/cluster/package")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Collections.singletonMap("add", add))
|
.withPayload(Collections.singletonMap("add", add))
|
||||||
.build();
|
.build();
|
||||||
req.process(cluster.getSolrClient());
|
req.process(cluster.getSolrClient());
|
||||||
|
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/cluster/package").
|
() -> new V2Request.Builder("/cluster/package")
|
||||||
withMethod(SolrRequest.METHOD.GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
Utils.makeMap(
|
Utils.makeMap(
|
||||||
":result:packages:schemapkg[0]:version", "1.0",
|
":result:packages:schemapkg[0]:version", "1.0",
|
||||||
|
@ -699,14 +699,14 @@ public class TestPackages extends SolrCloudTestCase {
|
||||||
add.files = Arrays.asList(FILE1);
|
add.files = Arrays.asList(FILE1);
|
||||||
req = new V2Request.Builder("/cluster/package")
|
req = new V2Request.Builder("/cluster/package")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload(Collections.singletonMap("add", add))
|
.withPayload(Collections.singletonMap("add", add))
|
||||||
.build();
|
.build();
|
||||||
req.process(cluster.getSolrClient());
|
req.process(cluster.getSolrClient());
|
||||||
|
|
||||||
TestDistribPackageStore.assertResponseValues(10,
|
TestDistribPackageStore.assertResponseValues(10,
|
||||||
() -> new V2Request.Builder("/cluster/package").
|
() -> new V2Request.Builder("/cluster/package")
|
||||||
withMethod(SolrRequest.METHOD.GET)
|
.GET()
|
||||||
.build().process(cluster.getSolrClient()),
|
.build().process(cluster.getSolrClient()),
|
||||||
Utils.makeMap(
|
Utils.makeMap(
|
||||||
":result:packages:schemapkg[0]:version", "2.0",
|
":result:packages:schemapkg[0]:version", "2.0",
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase {
|
||||||
@SuppressWarnings({"rawtypes"})
|
@SuppressWarnings({"rawtypes"})
|
||||||
final SolrRequest genericReq;
|
final SolrRequest genericReq;
|
||||||
if (isUseV2Api) {
|
if (isUseV2Api) {
|
||||||
genericReq = new V2Request.Builder("/cluster/security/authentication").withMethod(SolrRequest.METHOD.POST).build();
|
genericReq = new V2Request.Builder("/cluster/security/authentication").POST().build();
|
||||||
} else {
|
} else {
|
||||||
genericReq = new GenericSolrRequest(SolrRequest.METHOD.POST, authcPrefix, new ModifiableSolrParams());
|
genericReq = new GenericSolrRequest(SolrRequest.METHOD.POST, authcPrefix, new ModifiableSolrParams());
|
||||||
((GenericSolrRequest)genericReq).setContentWriter(new StringPayloadContentWriter(command, CommonParams.JSON_MIME));
|
((GenericSolrRequest)genericReq).setContentWriter(new StringPayloadContentWriter(command, CommonParams.JSON_MIME));
|
||||||
|
|
|
@ -30,7 +30,6 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||||
|
@ -123,7 +122,7 @@ public abstract class RoutedAliasUpdateProcessorTest extends SolrCloudTestCase {
|
||||||
Thread.sleep(500); // YUCK but works (beasts 2500x20 ok vs failing in ~500x20 every time)
|
Thread.sleep(500); // YUCK but works (beasts 2500x20 ok vs failing in ~500x20 every time)
|
||||||
// manipulate the config...
|
// manipulate the config...
|
||||||
checkNoError(getSolrClient().request(new V2Request.Builder("/collections/" + configName + "/config")
|
checkNoError(getSolrClient().request(new V2Request.Builder("/collections/" + configName + "/config")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{" +
|
.withPayload("{" +
|
||||||
" 'set-user-property' : {'update.autoCreateFields':false}," + // no data driven
|
" 'set-user-property' : {'update.autoCreateFields':false}," + // no data driven
|
||||||
" 'add-updateprocessor' : {" +
|
" 'add-updateprocessor' : {" +
|
||||||
|
@ -141,7 +140,7 @@ public abstract class RoutedAliasUpdateProcessorTest extends SolrCloudTestCase {
|
||||||
// only sometimes test with "tolerant" URP:
|
// only sometimes test with "tolerant" URP:
|
||||||
final String urpNames = "inc" + (random().nextBoolean() ? ",tolerant" : "");
|
final String urpNames = "inc" + (random().nextBoolean() ? ",tolerant" : "");
|
||||||
checkNoError(getSolrClient().request(new V2Request.Builder("/collections/" + configName + "/config/params")
|
checkNoError(getSolrClient().request(new V2Request.Builder("/collections/" + configName + "/config/params")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{" +
|
.withPayload("{" +
|
||||||
" 'set' : {" +
|
" 'set' : {" +
|
||||||
" '_UPDATE' : {'processor':'" + urpNames + "'}" +
|
" '_UPDATE' : {'processor':'" + urpNames + "'}" +
|
||||||
|
|
|
@ -160,6 +160,26 @@ public class V2Request extends SolrRequest<V2Response> implements MapWriter {
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder GET() {
|
||||||
|
this.method = METHOD.GET;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder POST() {
|
||||||
|
this.method = METHOD.POST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder DELETE() {
|
||||||
|
this.method = METHOD.DELETE;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder PUT() {
|
||||||
|
this.method = METHOD.PUT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder withMethod(METHOD m) {
|
public Builder withMethod(METHOD m) {
|
||||||
this.method = m;
|
this.method = m;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.lang.invoke.MethodHandles;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.solr.client.solrj.SolrClient;
|
import org.apache.solr.client.solrj.SolrClient;
|
||||||
import org.apache.solr.client.solrj.SolrRequest;
|
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;
|
import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;
|
||||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||||
|
@ -51,7 +50,7 @@ public class TestV2Request extends SolrCloudTestCase {
|
||||||
public void testApiPathAvailability() throws Exception {
|
public void testApiPathAvailability() throws Exception {
|
||||||
V2Response rsp = new V2Request.Builder("/cluster/nodes")
|
V2Response rsp = new V2Request.Builder("/cluster/nodes")
|
||||||
.forceV2(true)
|
.forceV2(true)
|
||||||
.withMethod(SolrRequest.METHOD.GET).build()
|
.GET().build()
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
@SuppressWarnings({"rawtypes"})
|
@SuppressWarnings({"rawtypes"})
|
||||||
List l = (List) rsp._get("nodes",null);
|
List l = (List) rsp._get("nodes",null);
|
||||||
|
@ -98,7 +97,7 @@ public class TestV2Request extends SolrCloudTestCase {
|
||||||
|
|
||||||
private void doTest(SolrClient client) throws IOException, SolrServerException {
|
private void doTest(SolrClient client) throws IOException, SolrServerException {
|
||||||
assertSuccess(client, new V2Request.Builder("/collections")
|
assertSuccess(client, new V2Request.Builder("/collections")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{" +
|
.withPayload("{" +
|
||||||
" 'create' : {" +
|
" 'create' : {" +
|
||||||
" 'name' : 'test'," +
|
" 'name' : 'test'," +
|
||||||
|
@ -113,12 +112,12 @@ public class TestV2Request extends SolrCloudTestCase {
|
||||||
|
|
||||||
String requestHandlerName = "/x" + random().nextInt();
|
String requestHandlerName = "/x" + random().nextInt();
|
||||||
assertSuccess(client, new V2Request.Builder("/c/test/config")
|
assertSuccess(client, new V2Request.Builder("/c/test/config")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{'create-requesthandler' : { 'name' : '" + requestHandlerName +
|
.withPayload("{'create-requesthandler' : { 'name' : '" + requestHandlerName +
|
||||||
"', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy'}}")
|
"', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy'}}")
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
assertSuccess(client, new V2Request.Builder("/c/test").withMethod(SolrRequest.METHOD.DELETE).build());
|
assertSuccess(client, new V2Request.Builder("/c/test").DELETE().build());
|
||||||
NamedList<Object> res = client.request(new V2Request.Builder("/c").build());
|
NamedList<Object> res = client.request(new V2Request.Builder("/c").build());
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,7 +126,7 @@ public class TestV2Request extends SolrCloudTestCase {
|
||||||
// assertFalse( collections.contains("test"));
|
// assertFalse( collections.contains("test"));
|
||||||
try{
|
try{
|
||||||
NamedList<Object> res1 = client.request(new V2Request.Builder("/collections")
|
NamedList<Object> res1 = client.request(new V2Request.Builder("/collections")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{" +
|
.withPayload("{" +
|
||||||
" 'create' : {" +
|
" 'create' : {" +
|
||||||
" 'name' : 'jsontailtest'," +
|
" 'name' : 'jsontailtest'," +
|
||||||
|
@ -144,7 +143,7 @@ public class TestV2Request extends SolrCloudTestCase {
|
||||||
public void testV2Forwarding() throws Exception {
|
public void testV2Forwarding() throws Exception {
|
||||||
SolrClient client = cluster.getSolrClient();
|
SolrClient client = cluster.getSolrClient();
|
||||||
assertSuccess(client, new V2Request.Builder("/collections")
|
assertSuccess(client, new V2Request.Builder("/collections")
|
||||||
.withMethod(SolrRequest.METHOD.POST)
|
.POST()
|
||||||
.withPayload("{" +
|
.withPayload("{" +
|
||||||
" 'create' : {" +
|
" 'create' : {" +
|
||||||
" 'name' : 'v2forward'," +
|
" 'name' : 'v2forward'," +
|
||||||
|
@ -168,7 +167,7 @@ public class TestV2Request extends SolrCloudTestCase {
|
||||||
|
|
||||||
String testServer = cluster.getSolrClient().getZkStateReader().getBaseUrlForNodeName(testNode[0]);
|
String testServer = cluster.getSolrClient().getZkStateReader().getBaseUrlForNodeName(testNode[0]);
|
||||||
V2Request v2r = new V2Request.Builder("/c/v2forward/_introspect")
|
V2Request v2r = new V2Request.Builder("/c/v2forward/_introspect")
|
||||||
.withMethod(SolrRequest.METHOD.GET).build();
|
.GET().build();
|
||||||
|
|
||||||
try(HttpSolrClient client1 = new HttpSolrClient.Builder()
|
try(HttpSolrClient client1 = new HttpSolrClient.Builder()
|
||||||
.withBaseSolrUrl(testServer)
|
.withBaseSolrUrl(testServer)
|
||||||
|
|
Loading…
Reference in New Issue