You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by du...@apache.org on 2019/09/18 11:57:47 UTC

[sling-org-apache-sling-testing-clients] branch master updated: SLING-8710: IndexingClient should have configurable lanes

This is an automated email from the ASF dual-hosted git repository.

dulvac pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new 2dfaecd  SLING-8710: IndexingClient should have configurable lanes
2dfaecd is described below

commit 2dfaecd95e58c87385d8f26d1e8c60072990e54f
Author: Vikas Saurabh <vs...@adobe.com>
AuthorDate: Tue Sep 17 20:28:50 2019 +0530

    SLING-8710: IndexingClient should have configurable lanes
    
    Was storing lane names incorrectly which got missed in the test case
    because test lanes names was incorrectly set to an array of single
    string with comma in the string while it should have been an array of
    two separate strings.
---
 .../sling/testing/clients/indexing/IndexingClient.java      |  2 +-
 .../sling/testing/clients/indexing/IndexingClientTest.java  | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/clients/indexing/IndexingClient.java b/src/main/java/org/apache/sling/testing/clients/indexing/IndexingClient.java
index 2bbea26..1af1e4a 100644
--- a/src/main/java/org/apache/sling/testing/clients/indexing/IndexingClient.java
+++ b/src/main/java/org/apache/sling/testing/clients/indexing/IndexingClient.java
@@ -182,7 +182,7 @@ public class IndexingClient extends SlingClient {
      * @param laneNames lane names to work on
      */
     public void setLaneNames(String ... laneNames) {
-        getValues().put(INDEX_LANES_CSV_CONFIG_NAME, StringUtils.join(laneNames));
+        getValues().put(INDEX_LANES_CSV_CONFIG_NAME, StringUtils.join(laneNames, ','));
     }
 
     /**
diff --git a/src/test/java/org/apache/sling/testing/clients/indexing/IndexingClientTest.java b/src/test/java/org/apache/sling/testing/clients/indexing/IndexingClientTest.java
index 6346afc..2bbae1d 100644
--- a/src/test/java/org/apache/sling/testing/clients/indexing/IndexingClientTest.java
+++ b/src/test/java/org/apache/sling/testing/clients/indexing/IndexingClientTest.java
@@ -27,6 +27,7 @@ import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.sling.testing.clients.ClientException;
 import org.apache.sling.testing.clients.HttpServerRule;
 import org.apache.sling.testing.clients.query.servlet.QueryServlet;
+import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.ClassRule;
 import org.junit.Test;
@@ -46,7 +47,7 @@ public class IndexingClientTest {
     private static final String EXPLAIN_RESPONSE = "{\"plan\": \"random plan with testIndexingLane-async and testIndexingLane-fulltext-async\",\"time\": 1}";
     private static final String QUERY_RESPONSE = "{\"total\": 1234,\"time\": 1}";
 
-    private static final String [] PRE_DEFINED_INDEXING_LANES = new String[]{"async, fulltext-async"};
+    private static final String [] PRE_DEFINED_INDEXING_LANES = new String[]{"async", "fulltext-async"};
 
     private static final AtomicInteger NUM_INDEXING_LANE_CONSOLE_CALLS = new AtomicInteger();
 
@@ -210,9 +211,19 @@ public class IndexingClientTest {
     @Test
     public void testWaitForAsyncIndexingConfiguredLanes() throws ClientException, TimeoutException, InterruptedException {
         client.setLaneNames(PRE_DEFINED_INDEXING_LANES);
+
+        List<String> retrievedLaneNames = client.getLaneNames();
+        Assert.assertEquals("Mismatched number of lanes", PRE_DEFINED_INDEXING_LANES.length, retrievedLaneNames.size());
+        Assert.assertThat(retrievedLaneNames, CoreMatchers.hasItems(PRE_DEFINED_INDEXING_LANES));
+
         client.waitForAsyncIndexing();
 
         IndexingClient otherClient = client.adaptTo(IndexingClient.class);
+
+        retrievedLaneNames = otherClient.getLaneNames();
+        Assert.assertEquals("Mismatched number of lanes", PRE_DEFINED_INDEXING_LANES.length, retrievedLaneNames.size());
+        Assert.assertThat(retrievedLaneNames, CoreMatchers.hasItems(PRE_DEFINED_INDEXING_LANES));
+
         otherClient.waitForAsyncIndexing();
 
         Assert.assertEquals("Must not get indexing lanes from /system/console",