sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r654440 - in /incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling: MockRequestProgressTracker.java MockSlingHttpServletRequest.java
Date Thu, 08 May 2008 07:52:18 GMT
Author: fmeschbe
Date: Thu May  8 00:52:17 2008
New Revision: 654440

URL: http://svn.apache.org/viewvc?rev=654440&view=rev
Log:
Add RequestProgressTracker (null implementation) to mock request

Added:
    incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
Modified:
    incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java

Added: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java?rev=654440&view=auto
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
(added)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
Thu May  8 00:52:17 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.testing.sling;
+
+import java.io.PrintWriter;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.apache.sling.api.request.RequestProgressTracker;
+
+public class MockRequestProgressTracker implements RequestProgressTracker {
+
+    public void dump(PrintWriter writer) {
+    }
+
+    public Iterator<String> getMessages() {
+        return Collections.<String> emptyList().iterator();
+    }
+
+    public void log(String message) {
+    }
+
+    public void log(String format, Object... args) {
+    }
+
+    public void logTimer(String timerName) {
+    }
+
+    public void logTimer(String timerName, String format, Object... args) {
+    }
+
+    public void startTimer(String timerName) {
+    }
+
+}

Modified: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java?rev=654440&r1=654439&r2=654440&view=diff
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java
(original)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java
Thu May  8 00:52:17 2008
@@ -19,8 +19,10 @@
 package org.apache.sling.commons.testing.sling;
 
 import java.io.BufferedReader;
+import java.io.PrintWriter;
 import java.security.Principal;
 import java.util.Enumeration;
+import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
@@ -58,6 +60,8 @@
     private boolean secure = false;
 
     private MockResourceResolver mockResourceResolver;
+    
+    private RequestProgressTracker mockRequestProgressTracker;
 
     public static final String RESOURCE_TYPE = "foo/bar";
 
@@ -132,7 +136,10 @@
     }
 
     public RequestProgressTracker getRequestProgressTracker() {
-        return null;
+        if (mockRequestProgressTracker == null) {
+            mockRequestProgressTracker = new MockRequestProgressTracker();
+        }
+        return mockRequestProgressTracker;
     }
 
     public Resource getResource() {



Mime
View raw message