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 10:17:17 UTC

[sling-org-apache-sling-testing-clients] 03/06: SLING-6405 - Make testing.clients.interceptors.TestDescriptionInterceptor in line with TestLogServlet from junit core

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

rombert pushed a commit to annotated tag org.apache.sling.testing.clients-1.0.1
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-clients.git

commit b7333cad075025e77b844201fa99cc3a93e6d2f5
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Thu Jan 5 08:28:33 2017 +0000

    SLING-6405 - Make testing.clients.interceptors.TestDescriptionInterceptor in line with TestLogServlet from junit core
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/http/clients@1777434 13f79535-47bb-0310-9956-ffa450edef68
---
 .../clients/interceptors/TestDescriptionInterceptor.java  | 15 +++++++++++----
 .../sling/testing/clients/interceptors/package-info.java  |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java b/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java
index 38b269e..ad91912 100644
--- a/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java
+++ b/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java
@@ -32,11 +32,18 @@ import java.io.IOException;
  * @see org.slf4j.MDC http://www.slf4j.org/manual.html
  */
 public class TestDescriptionInterceptor implements HttpRequestInterceptor{
-    public static final String TEST_NAME_HEADER = "sling.test.name";
-    public static final String TEST_CLASS_HEADER = "sling.test.class";
+    //Same headers are defined in TestLogServlet
+    public static final String TEST_CLASS_HEADER = "X-Sling-TestClass";
+    public static final String TEST_NAME_HEADER = "X-Sling-TestName";
 
     public void process(HttpRequest httpRequest, HttpContext httpContext) throws HttpException, IOException {
-            httpRequest.addHeader(TEST_NAME_HEADER, TestDescriptionHolder.getMethodName());
-            httpRequest.addHeader(TEST_CLASS_HEADER, TestDescriptionHolder.getClassName());
+        addHeader(httpRequest, TEST_NAME_HEADER, TestDescriptionHolder.getMethodName());
+        addHeader(httpRequest, TEST_CLASS_HEADER, TestDescriptionHolder.getClassName());
+    }
+
+    private static void addHeader(HttpRequest httpRequest, String name, String value){
+        if (value != null){
+            httpRequest.addHeader(name, value);
+        }
     }
 }
diff --git a/src/main/java/org/apache/sling/testing/clients/interceptors/package-info.java b/src/main/java/org/apache/sling/testing/clients/interceptors/package-info.java
index 1de07e5..49e7065 100644
--- a/src/main/java/org/apache/sling/testing/clients/interceptors/package-info.java
+++ b/src/main/java/org/apache/sling/testing/clients/interceptors/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.0.0")
+@Version("1.0.1")
 package org.apache.sling.testing.clients.interceptors;
 
 import aQute.bnd.annotation.Version;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.