dsmiley commented on code in PR #4266:
URL: https://github.com/apache/solr/pull/4266#discussion_r3041838662


##########
solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java:
##########
@@ -238,49 +228,53 @@ public void testProperties() throws Exception {
   public void testModifyPropertiesV2() throws Exception {
     final String aliasName = getSaferTestName();
     ZkStateReader zkStateReader = createColectionsAndAlias(aliasName);
-    final String baseUrl = 
cluster.getRandomJetty(random()).getBaseURLV2().toString();
+    final JettySolrRunner runner = cluster.getRandomJetty(random());
+    final String baseUrl = runner.getBaseURLV2().toString();
+    final HttpClient httpClient = runner.getSolrClient().getHttpClient();
     String aliasApi = String.format(Locale.ENGLISH, "/aliases/%s/properties", 
aliasName);
 
-    HttpPut withoutBody = new HttpPut(baseUrl + aliasApi);
-    assertEquals(400, 
httpClient.execute(withoutBody).getStatusLine().getStatusCode());
-
-    HttpPut update = new HttpPut(baseUrl + aliasApi);
-    update.setEntity(
-        new StringEntity(
-            "{\n"
-                + "    \"properties\":\n"
-                + "    {\n"
-                + "        \"foo\": \"baz\",\n"
-                + "        \"bar\": \"bam\"\n"
-                + "    }\n"
-                + "}",
-            ContentType.APPLICATION_JSON));
-    assertSuccess(update);
+    assertEquals(
+        400, httpClient.newRequest(baseUrl + 
aliasApi).method(HttpMethod.PUT).send().getStatus());
+
+    String body =
+        "{\n"
+            + "    \"properties\":\n"
+            + "    {\n"
+            + "        \"foo\": \"baz\",\n"
+            + "        \"bar\": \"bam\"\n"
+            + "    }\n"
+            + "}";
+    assertSuccess(
+        httpClient
+            .newRequest(baseUrl + aliasApi)
+            .method(HttpMethod.PUT)
+            .body(new StringRequestContent("application/json", body, 
StandardCharsets.UTF_8))
+            .send());
     checkFooAndBarMeta(aliasName, zkStateReader, "baz", "bam");
 
     String aliasPropertyApi =
         String.format(Locale.ENGLISH, "/aliases/%s/properties/%s", aliasName, 
"foo");
-    HttpPut updateByProperty = new HttpPut(baseUrl + aliasPropertyApi);
-    updateByProperty.setEntity(
-        new StringEntity("{ \"value\": \"zab\" }", 
ContentType.APPLICATION_JSON));
-    assertSuccess(updateByProperty);
+    assertSuccess(
+        httpClient
+            .newRequest(baseUrl + aliasPropertyApi)
+            .method(HttpMethod.PUT)
+            .body(
+                new StringRequestContent(
+                    "application/json", "{ \"value\": \"zab\" }", 
StandardCharsets.UTF_8))
+            .send());
     checkFooAndBarMeta(aliasName, zkStateReader, "zab", "bam");
 
-    HttpDelete deleteByProperty = new HttpDelete(baseUrl + aliasPropertyApi);
-    assertSuccess(deleteByProperty);
+    assertSuccess(
+        httpClient.newRequest(baseUrl + 
aliasPropertyApi).method(HttpMethod.DELETE).send());
     checkFooAndBarMeta(aliasName, zkStateReader, null, "bam");
 
-    HttpPut deleteByEmptyValue = new HttpPut(baseUrl + aliasApi);
-    deleteByEmptyValue.setEntity(
-        new StringEntity(
-            "{\n"
-                + "    \"properties\":\n"
-                + "    {\n"
-                + "        \"bar\": \"\"\n"
-                + "    }\n"
-                + "}",
-            ContentType.APPLICATION_JSON));
-    assertSuccess(deleteByEmptyValue);
+    body = "{ \"properties\": { \"bar\": \"\" } }";

Review Comment:
   for one-liners, no it forces you to use another line.  So I don't plan to 
update much for this matter.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to