cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r609750 - /cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/environment/mock/MockRequestAttributes.java
Date Mon, 07 Jan 2008 19:29:19 GMT
Author: cziegeler
Date: Mon Jan  7 11:29:18 2008
New Revision: 609750

URL: http://svn.apache.org/viewvc?rev=609750&view=rev
Log:
Make test case compile again.

Modified:
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/environment/mock/MockRequestAttributes.java

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/environment/mock/MockRequestAttributes.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/environment/mock/MockRequestAttributes.java?rev=609750&r1=609749&r2=609750&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/environment/mock/MockRequestAttributes.java
(original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/test/java/org/apache/cocoon/environment/mock/MockRequestAttributes.java
Mon Jan  7 11:29:18 2008
@@ -18,6 +18,9 @@
  */
 package org.apache.cocoon.environment.mock;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -126,4 +129,24 @@
             task.run();
         }
     }
+
+    public String[] getAttributeNames(int scope) {
+        Enumeration names = null;
+        if ( scope == RequestAttributes.SCOPE_REQUEST ) {
+            names = this.request.getLocalAttributeNames();
+        } else if ( scope == RequestAttributes.SCOPE_SESSION ) {
+            names = this.request.getAttributeNames();
+        } else {
+            final HttpSession session = this.request.getSession(false);
+            if ( session != null ) {
+                names = session.getAttributeNames();
+            }
+        }
+        if ( names == null ) {
+            return new String[0];
+        }
+        ArrayList attributeNames = Collections.list(names);
+        return (String[]) attributeNames.toArray(new String[attributeNames.size()]);
+    }
+
 }



Mime
View raw message