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