sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1777433 - in /sling/trunk/testing/junit/core: pom.xml src/main/java/org/apache/sling/junit/impl/servlet/TestLogServlet.java
Date Thu, 05 Jan 2017 08:28:22 GMT
Author: chetanm
Date: Thu Jan  5 08:28:22 2017
New Revision: 1777433

URL: http://svn.apache.org/viewvc?rev=1777433&view=rev
Log:
SLING-6406 - TestLogServlet should register filter using HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN

-- Added new whiteboard properties
 -- Changed the header name to 'X-Sling-TestName' from 'X-Sling-Test-Name' to avoid conflict
with TestNameLoggingFilter in tools module (which is deprecated)

Modified:
    sling/trunk/testing/junit/core/pom.xml
    sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/TestLogServlet.java

Modified: sling/trunk/testing/junit/core/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/pom.xml?rev=1777433&r1=1777432&r2=1777433&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/pom.xml (original)
+++ sling/trunk/testing/junit/core/pom.xml Thu Jan  5 08:28:22 2017
@@ -145,6 +145,12 @@
             <artifactId>servlet-api</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.http.whiteboard</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
             <version>1.5.11</version>

Modified: sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/TestLogServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/TestLogServlet.java?rev=1777433&r1=1777432&r2=1777433&view=diff
==============================================================================
--- sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/TestLogServlet.java
(original)
+++ sling/trunk/testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/TestLogServlet.java
Thu Jan  5 08:28:22 2017
@@ -46,6 +46,7 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.http.HttpService;
 import org.osgi.service.http.NamespaceException;
+import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
@@ -65,8 +66,9 @@ public class TestLogServlet extends Http
 
     //These name should be kept in sync with
     // org.apache.sling.testing.tools.junit.RemoteLogDumper
-    public static final String TEST_NAME = "X-Sling-Test-Name";
-    public static final String TEST_CLASS = "X-Sling-Test-Class";
+    // org.apache.sling.testing.clients.interceptors.TestDescriptionInterceptor
+    public static final String TEST_NAME = "X-Sling-TestName";
+    public static final String TEST_CLASS = "X-Sling-TestClass";
 
     @Property(value="/system/sling/testlog")
     static final String SERVLET_PATH_NAME = "servlet.path";
@@ -122,7 +124,7 @@ public class TestLogServlet extends Http
         if (description != null && !description.equals(currentTest)){
             currentTest = description;
             resetAppender();
-            log.info("Starting test execution {}", description);
+            log.info("Starting test execution ======[{}]======", description);
         }
     }
 
@@ -226,7 +228,9 @@ public class TestLogServlet extends Http
         props.put(Constants.SERVICE_DESCRIPTION, "Filter to extract testName from request
headers");
         props.put(Constants.SERVICE_VENDOR, ctx.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
 
-        props.put("pattern", "/.*");
+        props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/");
+        props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
+                "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)");
         filter = ctx.registerService(Filter.class.getName(), new TestNameLoggingFilter(),
props);
     }
 
@@ -279,7 +283,6 @@ public class TestLogServlet extends Http
     /**
      * Return the path at which to mount this servlet, or null
      * if it must not be mounted.
-     * @param ctx
      */
     private static String getServletPath(Map<String, ?> config) {
         String result = (String)config.get(SERVLET_PATH_NAME);



Mime
View raw message