You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by en...@apache.org on 2020/09/23 20:09:44 UTC

[sling-org-apache-sling-testing-serversetup] branch master updated: SLING-9764 Support regex pattern matching of the content for the server.ready.path checks

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 209d563  SLING-9764 Support regex pattern matching of the content for the server.ready.path checks
209d563 is described below

commit 209d5633e88bed18b25737132934b04a3a7c6a72
Author: Eric Norman <en...@apache.org>
AuthorDate: Wed Sep 23 13:09:33 2020 -0700

    SLING-9764 Support regex pattern matching of the content for the
    server.ready.path checks
---
 .../apache/sling/testing/serversetup/instance/SlingTestBase.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/testing/serversetup/instance/SlingTestBase.java b/src/main/java/org/apache/sling/testing/serversetup/instance/SlingTestBase.java
index b5bac36..a57369b 100644
--- a/src/main/java/org/apache/sling/testing/serversetup/instance/SlingTestBase.java
+++ b/src/main/java/org/apache/sling/testing/serversetup/instance/SlingTestBase.java
@@ -33,6 +33,7 @@ import org.apache.http.NameValuePair;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.sling.testing.clients.ClientException;
 import org.apache.sling.testing.clients.SlingClient;
+import org.apache.sling.testing.clients.SlingHttpResponse;
 import org.apache.sling.testing.clients.osgi.BundlesInstaller;
 import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
 import org.apache.sling.testing.clients.util.TimeoutsProvider;
@@ -303,10 +304,16 @@ public class SlingTestBase implements SlingInstance {
                 final String [] s = p.split(":");
                 final String path = s[0];
                 final String pattern = (s.length > 0 ? s[1] : "");
+                boolean isRegex = s.length > 1 ? "regexp".equals(s[2]) : false;
                 try {
                     URI uri = new URI(path);
                     List<NameValuePair> reqParams = extractParams(uri);
-                    osgiConsoleClient.doGet(uri.getPath(), reqParams, 200).checkContentContains(pattern);
+                    SlingHttpResponse get = osgiConsoleClient.doGet(uri.getPath(), reqParams, 200);
+                    if (isRegex) {
+                        get.checkContentRegexp(pattern);
+                    } else {
+                        get.checkContentContains(pattern);
+                    }
                 } catch(ClientException e) {
                     errors = true;
                     log.debug("Request to {}@{} failed, will retry ({})",