You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:52:00 UTC
[sling-org-apache-sling-junit-healthcheck] 44/45: SLING-3084 - add
forceReload option to JUnitServlet
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.junit.healthcheck-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-junit-healthcheck.git
commit a2ffd495c3eafee173d6c0b549afc804828a191c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 19 12:42:13 2013 +0000
SLING-3084 - add forceReload option to JUnitServlet
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/junit/remote@1524717 13f79535-47bb-0310-9956-ffa450edef68
---
.../remote/httpclient/RemoteTestHttpClient.java | 24 ++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java b/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java
index 2091236..713feeb 100644
--- a/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java
+++ b/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java
@@ -17,10 +17,16 @@
package org.apache.sling.junit.remote.httpclient;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
import org.apache.sling.testing.tools.http.Request;
import org.apache.sling.testing.tools.http.RequestBuilder;
import org.apache.sling.testing.tools.http.RequestCustomizer;
@@ -70,7 +76,12 @@ public class RemoteTestHttpClient {
requestCustomizer = c;
}
- public RequestExecutor runTests(String testClassesSelector, String testMethodSelector, String extension)
+ public RequestExecutor runTests(String testClassesSelector, String testMethodSelector, String extension)
+ throws ClientProtocolException, IOException {
+ return runTests(testClassesSelector, testMethodSelector, extension, null);
+ }
+
+ public RequestExecutor runTests(String testClassesSelector, String testMethodSelector, String extension, Map<String, String> requestOptions)
throws ClientProtocolException, IOException {
final RequestBuilder builder = new RequestBuilder(junitServletUrl);
@@ -104,13 +115,22 @@ public class RemoteTestHttpClient {
subpath.append(DOT);
}
subpath.append(extension);
+
+ // Request options if any
+ final List<NameValuePair> opt = new ArrayList<NameValuePair>();
+ if(requestOptions != null) {
+ for(Map.Entry<String, String> e : requestOptions.entrySet()) {
+ opt.add(new BasicNameValuePair(e.getKey(), e.getValue()));
+ }
+ }
log.info("Executing test remotely, path={} JUnit servlet URL={}",
subpath, junitServletUrl);
final Request r = builder
.buildPostRequest(subpath.toString())
.withCredentials(username, password)
- .withCustomizer(requestCustomizer);
+ .withCustomizer(requestCustomizer)
+ .withEntity(new UrlEncodedFormEntity(opt));
executor.execute(r).assertStatus(200);
return executor;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.