struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r471756 [23/31] - in /struts/struts2/trunk: apps/blank/ apps/blank/src/main/java/example/ apps/blank/src/test/java/example/ apps/mailreader/src/main/java/mailreader2/ apps/portlet/src/main/java/org/apache/struts2/portlet/example/ apps/portl...
Date Mon, 06 Nov 2006 15:02:22 GMT
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -30,19 +33,19 @@
  */
 public class NullActionMapper implements ActionMapper {
 
-		private static ActionMapping _actionMapping;
-	
-		public NullActionMapper() {}
-		
-		public static void setActionMapping(ActionMapping actionMappingToBeRetrned) {
-			_actionMapping = actionMappingToBeRetrned;
-		}
-		
-		public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) {
-			return _actionMapping;
-		}
-
-		public String getUriFromActionMapping(ActionMapping mapping) {
-			throw new UnsupportedOperationException("operation not supported");
-		}
+        private static ActionMapping _actionMapping;
+
+        public NullActionMapper() {}
+
+        public static void setActionMapping(ActionMapping actionMappingToBeRetrned) {
+            _actionMapping = actionMappingToBeRetrned;
+        }
+
+        public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) {
+            return _actionMapping;
+        }
+
+        public String getUriFromActionMapping(ActionMapping mapping) {
+            throw new UnsupportedOperationException("operation not supported");
+        }
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -36,119 +39,119 @@
 
 /**
  * Test case for PlainTextResult.
- * 
+ *
  */
 public class PlainTextResultTest extends TestCase {
-	
-	ValueStack stack;
-	MockActionInvocation invocation;
-	ActionContext context;
-	StrutsMockHttpServletResponse response;
-	PrintWriter writer;
-	StringWriter stringWriter;
-	StrutsMockServletContext servletContext;
-	
-
-	public void testPlainText() throws Exception {
-		PlainTextResult result = new PlainTextResult();
-		result.setLocation("/someJspFile.jsp");
-		
-		response.setExpectedContentType("text/plain");
-		response.setExpectedHeader("Content-Disposition", "inline");
-		InputStream jspResourceInputStream = 
-			ClassLoaderUtil.getResourceAsStream(
-				"org/apache/struts2/dispatcher/someJspFile.jsp",
-				PlainTextResultTest.class);
-		
-		
-		try {
-			servletContext.setResourceAsStream(jspResourceInputStream);
-			result.execute(invocation);
-			
-			String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
-			String e = AbstractUITagTest.normalize(
-					readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
-			assertEquals(r, e);
-		}
-		finally {
-			jspResourceInputStream.close();
-		}
-	}
-	
-	public void testPlainTextWithEncoding() throws Exception {
-		PlainTextResult result = new PlainTextResult();
-		result.setLocation("/someJspFile.jsp");
-		result.setCharSet("UTF-8");
-		
-		response.setExpectedContentType("text/plain; charset=UTF-8");
-		response.setExpectedHeader("Content-Disposition", "inline");
-		InputStream jspResourceInputStream = 
-			ClassLoaderUtil.getResourceAsStream(
-				"org/apache/struts2/dispatcher/someJspFile.jsp",
-				PlainTextResultTest.class);
-		
-		
-		try {
-			servletContext.setResourceAsStream(jspResourceInputStream);
-			result.execute(invocation);
-			
-			String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
-			String e = AbstractUITagTest.normalize(
-					readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
-			assertEquals(r, e);
-		}
-		finally {
-			jspResourceInputStream.close();
-		}
-	}
-	
-	protected String readAsString(String resource) throws Exception {
-		InputStream is = null;
-		try {
-			is = ClassLoaderUtil.getResourceAsStream(resource, PlainTextResultTest.class);
-			int sizeRead = 0;
-			byte[] buffer = new byte[1024];
-			StringBuffer stringBuffer = new StringBuffer();
-			while((sizeRead = is.read(buffer)) != -1) {
-				stringBuffer.append(new String(buffer, 0, sizeRead));
-			}
-			return stringBuffer.toString();
-		}
-		finally {
-			if (is != null) 
-				is.close();
-		}
-	
-	}
-	
-	
-	protected void setUp() throws Exception {
-		super.setUp();
-		
-		stringWriter = new StringWriter();
-		writer = new PrintWriter(stringWriter);
-		response = new StrutsMockHttpServletResponse();
-		response.setWriter(writer);
-		servletContext = new StrutsMockServletContext();
-		stack = ValueStackFactory.getFactory().createValueStack();
-		context = new ActionContext(stack.getContext());
-		context.put(StrutsStatics.HTTP_RESPONSE, response);
-		context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
-		invocation = new MockActionInvocation();
-		invocation.setStack(stack);
-		invocation.setInvocationContext(context);
-	}
-	
-	
-	protected void tearDown() throws Exception {
-		stack = null;
-		invocation = null;
-		context = null;
-		response = null;
-		writer = null;
-		stringWriter = null;
-		servletContext = null;
-		
-		super.tearDown();
-	}
+
+    ValueStack stack;
+    MockActionInvocation invocation;
+    ActionContext context;
+    StrutsMockHttpServletResponse response;
+    PrintWriter writer;
+    StringWriter stringWriter;
+    StrutsMockServletContext servletContext;
+
+
+    public void testPlainText() throws Exception {
+        PlainTextResult result = new PlainTextResult();
+        result.setLocation("/someJspFile.jsp");
+
+        response.setExpectedContentType("text/plain");
+        response.setExpectedHeader("Content-Disposition", "inline");
+        InputStream jspResourceInputStream =
+            ClassLoaderUtil.getResourceAsStream(
+                "org/apache/struts2/dispatcher/someJspFile.jsp",
+                PlainTextResultTest.class);
+
+
+        try {
+            servletContext.setResourceAsStream(jspResourceInputStream);
+            result.execute(invocation);
+
+            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
+            String e = AbstractUITagTest.normalize(
+                    readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
+            assertEquals(r, e);
+        }
+        finally {
+            jspResourceInputStream.close();
+        }
+    }
+
+    public void testPlainTextWithEncoding() throws Exception {
+        PlainTextResult result = new PlainTextResult();
+        result.setLocation("/someJspFile.jsp");
+        result.setCharSet("UTF-8");
+
+        response.setExpectedContentType("text/plain; charset=UTF-8");
+        response.setExpectedHeader("Content-Disposition", "inline");
+        InputStream jspResourceInputStream =
+            ClassLoaderUtil.getResourceAsStream(
+                "org/apache/struts2/dispatcher/someJspFile.jsp",
+                PlainTextResultTest.class);
+
+
+        try {
+            servletContext.setResourceAsStream(jspResourceInputStream);
+            result.execute(invocation);
+
+            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
+            String e = AbstractUITagTest.normalize(
+                    readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
+            assertEquals(r, e);
+        }
+        finally {
+            jspResourceInputStream.close();
+        }
+    }
+
+    protected String readAsString(String resource) throws Exception {
+        InputStream is = null;
+        try {
+            is = ClassLoaderUtil.getResourceAsStream(resource, PlainTextResultTest.class);
+            int sizeRead = 0;
+            byte[] buffer = new byte[1024];
+            StringBuffer stringBuffer = new StringBuffer();
+            while((sizeRead = is.read(buffer)) != -1) {
+                stringBuffer.append(new String(buffer, 0, sizeRead));
+            }
+            return stringBuffer.toString();
+        }
+        finally {
+            if (is != null)
+                is.close();
+        }
+
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        stringWriter = new StringWriter();
+        writer = new PrintWriter(stringWriter);
+        response = new StrutsMockHttpServletResponse();
+        response.setWriter(writer);
+        servletContext = new StrutsMockServletContext();
+        stack = ValueStackFactory.getFactory().createValueStack();
+        context = new ActionContext(stack.getContext());
+        context.put(StrutsStatics.HTTP_RESPONSE, response);
+        context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
+        invocation = new MockActionInvocation();
+        invocation.setStack(stack);
+        invocation.setInvocationContext(context);
+    }
+
+
+    protected void tearDown() throws Exception {
+        stack = null;
+        invocation = null;
+        context = null;
+        response = null;
+        writer = null;
+        stringWriter = null;
+        servletContext = null;
+
+        super.tearDown();
+    }
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -39,121 +42,121 @@
  * @version $Date$ $Id$
  */
 public class ServletActionRedirectResultTest extends StrutsTestCase {
-	
-	public void testIncludeParameterInResultWithConditionParseOn() throws Exception {
-		
-		ResultConfig resultConfig = new ResultConfig();
-		resultConfig.addParam("actionName", "someActionName");
-		resultConfig.addParam("namespace", "someNamespace");
-		resultConfig.addParam("encode", "true");
-		resultConfig.addParam("parse", "true");
-		resultConfig.addParam("location", "someLocation");
-		resultConfig.addParam("prependServletContext", "true");
-		resultConfig.addParam("method", "someMethod");
-		resultConfig.addParam("param1", "${#value1}");
-		resultConfig.addParam("param2", "${#value2}");
-		resultConfig.addParam("param3", "${#value3}");
-		
-		
-		
-		ActionContext context = ActionContext.getContext();
-		ValueStack stack = context.getValueStack();
-		context.getContextMap().put("value1", "value 1");
-		context.getContextMap().put("value2", "value 2");
-		context.getContextMap().put("value3", "value 3");
-		MockHttpServletRequest req = new MockHttpServletRequest();
-		MockHttpServletResponse res = new MockHttpServletResponse();
-		context.put(ServletActionContext.HTTP_REQUEST, req);
-		context.put(ServletActionContext.HTTP_RESPONSE, res);
-		
-		
-		Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
-		results.put("myResult", resultConfig);
-		
-		ActionConfig actionConfig = new ActionConfig();
-		actionConfig.setResults(results);
-		
-		ServletActionRedirectResult result = new ServletActionRedirectResult();
-		result.setActionName("myAction");
-		result.setNamespace("/myNamespace");
-		result.setParse(true);
-		result.setEncode(false);
-		result.setPrependServletContext(false);
-		
-		IMocksControl control = EasyMock.createControl();
-		ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
-		ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
-		mockInvocation.getProxy();
-		control.andReturn(mockActionProxy);
-		mockInvocation.getResultCode();
-		control.andReturn("myResult");
-		mockActionProxy.getConfig();
-		control.andReturn(actionConfig);
-		mockInvocation.getInvocationContext();
-		control.andReturn(context);
-		mockInvocation.getStack();
-		control.andReturn(stack);
-		control.anyTimes();
-		
-		control.replay();
-		
-		result.execute(mockInvocation);
-		assertEquals("/myNamespace/myAction.action?param2=value+2&param1=value+1&param3=value+3", res.getRedirectedUrl());
-		
-		control.verify();
-	}
-	
-	public void testIncludeParameterInResult() throws Exception {
-		
-		ResultConfig resultConfig = new ResultConfig();
-		resultConfig.addParam("actionName", "someActionName");
-		resultConfig.addParam("namespace", "someNamespace");
-		resultConfig.addParam("encode", "true");
-		resultConfig.addParam("parse", "true");
-		resultConfig.addParam("location", "someLocation");
-		resultConfig.addParam("prependServletContext", "true");
-		resultConfig.addParam("method", "someMethod");
-		resultConfig.addParam("param1", "value 1");
-		resultConfig.addParam("param2", "value 2");
-		resultConfig.addParam("param3", "value 3");
-		
-		ActionContext context = ActionContext.getContext();
-		MockHttpServletRequest req = new MockHttpServletRequest();
-		MockHttpServletResponse res = new MockHttpServletResponse();
-		context.put(ServletActionContext.HTTP_REQUEST, req);
-		context.put(ServletActionContext.HTTP_RESPONSE, res);
-		
-		
-		Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
-		results.put("myResult", resultConfig);
-		
-		ActionConfig actionConfig = new ActionConfig();
-		actionConfig.setResults(results);
-		
-		ServletActionRedirectResult result = new ServletActionRedirectResult();
-		result.setActionName("myAction");
-		result.setNamespace("/myNamespace");
-		result.setParse(false);
-		result.setEncode(false);
-		result.setPrependServletContext(false);
-		
-		IMocksControl control = EasyMock.createControl();
-		ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
-		ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
-		mockInvocation.getProxy();
-		control.andReturn(mockActionProxy);
-		mockInvocation.getResultCode();
-		control.andReturn("myResult");
-		mockActionProxy.getConfig();
-		control.andReturn(actionConfig);
-		mockInvocation.getInvocationContext();
-		control.andReturn(context);
-		
-		control.replay();
-		
-		result.execute(mockInvocation);
-		assertEquals("/myNamespace/myAction.action?param2=value+2&param1=value+1&param3=value+3", res.getRedirectedUrl());
-		
-		control.verify();
-	}
+
+    public void testIncludeParameterInResultWithConditionParseOn() throws Exception {
+
+        ResultConfig resultConfig = new ResultConfig();
+        resultConfig.addParam("actionName", "someActionName");
+        resultConfig.addParam("namespace", "someNamespace");
+        resultConfig.addParam("encode", "true");
+        resultConfig.addParam("parse", "true");
+        resultConfig.addParam("location", "someLocation");
+        resultConfig.addParam("prependServletContext", "true");
+        resultConfig.addParam("method", "someMethod");
+        resultConfig.addParam("param1", "${#value1}");
+        resultConfig.addParam("param2", "${#value2}");
+        resultConfig.addParam("param3", "${#value3}");
+
+
+
+        ActionContext context = ActionContext.getContext();
+        ValueStack stack = context.getValueStack();
+        context.getContextMap().put("value1", "value 1");
+        context.getContextMap().put("value2", "value 2");
+        context.getContextMap().put("value3", "value 3");
+        MockHttpServletRequest req = new MockHttpServletRequest();
+        MockHttpServletResponse res = new MockHttpServletResponse();
+        context.put(ServletActionContext.HTTP_REQUEST, req);
+        context.put(ServletActionContext.HTTP_RESPONSE, res);
+
+
+        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
+        results.put("myResult", resultConfig);
+
+        ActionConfig actionConfig = new ActionConfig();
+        actionConfig.setResults(results);
+
+        ServletActionRedirectResult result = new ServletActionRedirectResult();
+        result.setActionName("myAction");
+        result.setNamespace("/myNamespace");
+        result.setParse(true);
+        result.setEncode(false);
+        result.setPrependServletContext(false);
+
+        IMocksControl control = EasyMock.createControl();
+        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
+        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
+        mockInvocation.getProxy();
+        control.andReturn(mockActionProxy);
+        mockInvocation.getResultCode();
+        control.andReturn("myResult");
+        mockActionProxy.getConfig();
+        control.andReturn(actionConfig);
+        mockInvocation.getInvocationContext();
+        control.andReturn(context);
+        mockInvocation.getStack();
+        control.andReturn(stack);
+        control.anyTimes();
+
+        control.replay();
+
+        result.execute(mockInvocation);
+        assertEquals("/myNamespace/myAction.action?param2=value+2&param1=value+1&param3=value+3", res.getRedirectedUrl());
+
+        control.verify();
+    }
+
+    public void testIncludeParameterInResult() throws Exception {
+
+        ResultConfig resultConfig = new ResultConfig();
+        resultConfig.addParam("actionName", "someActionName");
+        resultConfig.addParam("namespace", "someNamespace");
+        resultConfig.addParam("encode", "true");
+        resultConfig.addParam("parse", "true");
+        resultConfig.addParam("location", "someLocation");
+        resultConfig.addParam("prependServletContext", "true");
+        resultConfig.addParam("method", "someMethod");
+        resultConfig.addParam("param1", "value 1");
+        resultConfig.addParam("param2", "value 2");
+        resultConfig.addParam("param3", "value 3");
+
+        ActionContext context = ActionContext.getContext();
+        MockHttpServletRequest req = new MockHttpServletRequest();
+        MockHttpServletResponse res = new MockHttpServletResponse();
+        context.put(ServletActionContext.HTTP_REQUEST, req);
+        context.put(ServletActionContext.HTTP_RESPONSE, res);
+
+
+        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
+        results.put("myResult", resultConfig);
+
+        ActionConfig actionConfig = new ActionConfig();
+        actionConfig.setResults(results);
+
+        ServletActionRedirectResult result = new ServletActionRedirectResult();
+        result.setActionName("myAction");
+        result.setNamespace("/myNamespace");
+        result.setParse(false);
+        result.setEncode(false);
+        result.setPrependServletContext(false);
+
+        IMocksControl control = EasyMock.createControl();
+        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
+        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
+        mockInvocation.getProxy();
+        control.andReturn(mockActionProxy);
+        mockInvocation.getResultCode();
+        control.andReturn("myResult");
+        mockActionProxy.getConfig();
+        control.andReturn(actionConfig);
+        mockInvocation.getInvocationContext();
+        control.andReturn(context);
+
+        control.replay();
+
+        result.execute(mockInvocation);
+        assertEquals("/myNamespace/myAction.action?param2=value+2&param1=value+1&param3=value+3", res.getRedirectedUrl());
+
+        control.verify();
+    }
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -28,10 +31,10 @@
 /**
  */
 public class ServletDispatchedTestAssertInterceptor implements Interceptor {
-	
-	private static final long serialVersionUID = 1980347231443329805L;
 
-	public ServletDispatchedTestAssertInterceptor() {
+    private static final long serialVersionUID = 1980347231443329805L;
+
+    public ServletDispatchedTestAssertInterceptor() {
         super();
     }
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -104,7 +107,7 @@
         du.setConfigurationManager(cm);
         du.getConfigurationManager().getConfiguration().
             addPackageConfig("foo", new PackageConfig("foo", "/namespace", false, null));
-        
+
 
         view = new ServletRedirectResult();
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -44,29 +47,29 @@
 
 
     public void testClearInvalidatesTheSession() throws Exception {
-    	List<String> attributeNames = new ArrayList<String>();
-    	attributeNames.add("test");
-    	attributeNames.add("anotherTest");
-    	Enumeration attributeNamesEnum = Collections.enumeration(attributeNames);
-    	
+        List<String> attributeNames = new ArrayList<String>();
+        attributeNames.add("test");
+        attributeNames.add("anotherTest");
+        Enumeration attributeNamesEnum = Collections.enumeration(attributeNames);
+
         MockSessionMap sessionMap = new MockSessionMap((HttpServletRequest) requestMock.proxy());
-        sessionMock.expect("setAttribute", 
-        		new Constraint[] {
-        			new IsEqual("test"), new IsEqual("test value")
-        		});
-        sessionMock.expect("setAttribute", 
-        		new Constraint[] {
-        			new IsEqual("anotherTest"), new IsEqual("another test value")
-        		});
+        sessionMock.expect("setAttribute",
+                new Constraint[] {
+                    new IsEqual("test"), new IsEqual("test value")
+                });
+        sessionMock.expect("setAttribute",
+                new Constraint[] {
+                    new IsEqual("anotherTest"), new IsEqual("another test value")
+                });
         sessionMock.expectAndReturn("getAttributeNames", attributeNamesEnum);
-        sessionMock.expect("removeAttribute", 
-        		new Constraint[]{
-        			new IsEqual("test")
-        		});
-        sessionMock.expect("removeAttribute", 
-        		new Constraint[]{
-        			new IsEqual("anotherTest")
-        		});
+        sessionMock.expect("removeAttribute",
+                new Constraint[]{
+                    new IsEqual("test")
+                });
+        sessionMock.expect("removeAttribute",
+                new Constraint[]{
+                    new IsEqual("anotherTest")
+                });
         sessionMap.put("test", "test value");
         sessionMap.put("anotherTest", "another test value");
         sessionMap.clear();
@@ -161,10 +164,10 @@
      * putting new data into the map.
      */
     private class MockSessionMap extends SessionMap {
-    	
-		private static final long serialVersionUID = 8783604360786273764L;
-		
-		private Map map = new HashMap();
+
+        private static final long serialVersionUID = 8783604360786273764L;
+
+        private Map map = new HashMap();
 
         public MockSessionMap(HttpServletRequest request) {
             super(request);
@@ -180,10 +183,10 @@
 
             return originalValue;
         }
-        
+
         public void clear() {
-        	super.clear();
-        	map.clear();
+            super.clear();
+            map.clear();
         }
     }
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -111,9 +114,9 @@
     }
 
     public void testStreamResultParse1() throws Exception {
-    	///////////////////
+        ///////////////////
         result.setParse(true);
-        // ${...} conditionalParse of Result, returns String, 
+        // ${...} conditionalParse of Result, returns String,
         // which gets evaluated to the stack, that's how it works.
         // We use ${streamForImageAsString} that returns "streamForImage"
         // which is a property that returns an InputStream object.
@@ -135,13 +138,13 @@
         assertEquals(contentLength, response.getContentLength());
         assertEquals("filename=\"logo.png\"", response.getHeader("Content-disposition"));
     }
-    
+
     public void testStreamResultParse2() throws Exception {
-    	///////////////////
+        ///////////////////
         result.setParse(true);
         // This time we dun use ${...}, so streamForImage will
         // be evaluated to the stack, which should reaturn an
-        // InputStream object, cause there's such a property in 
+        // InputStream object, cause there's such a property in
         // the action object itself.
         result.setInputName("streamForImage");
         result.setBufferSize(128);
@@ -180,8 +183,8 @@
 
         ActionContext.getContext().put(ServletActionContext.HTTP_RESPONSE, response);
     }
-    
-    
+
+
 
     protected void tearDown() {
         response = null;
@@ -194,7 +197,7 @@
     public class MyImageAction implements Action {
 
         public InputStream getStreamForImage() throws Exception {
-            // just use src/test/log4j.properties as test file 
+            // just use src/test/log4j.properties as test file
             URL url = ClassLoaderUtil.getResource("log4j.properties", StreamResultTest.class);
             File file = new File(new URI(url.toString()));
             FileInputStream fis = new FileInputStream(file);
@@ -210,9 +213,9 @@
             File file = new File(new URI(url.toString()));
             return file.length();
         }
-        
+
         public String getStreamForImageAsString() {
-        	return "streamForImage";
+            return "streamForImage";
         }
     }
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -30,91 +33,91 @@
  */
 public class StrutsResultSupportTest extends StrutsTestCase {
 
-	
-	public void testParse() throws Exception {
-		ValueStack stack = ValueStackFactory.getFactory().createValueStack();
-		stack.push(new ActionSupport() {
-			public String getMyLocation() {
-				return "ThisIsMyLocation";
-			}
-		});
-		
-		ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
-		mockActionInvocation.getStack();
-		EasyMock.expectLastCall().andReturn(stack);
-		EasyMock.replay(mockActionInvocation);
-		
-		InternalStrutsResultSupport result = new InternalStrutsResultSupport();
-		result.setParse(true);
-		result.setEncode(false);
-		result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
-		
-		result.execute(mockActionInvocation);
-		
-		assertNotNull(result.getInternalLocation());
-		assertEquals("/pages/myJsp.jsp?location=ThisIsMyLocation", result.getInternalLocation());
-		EasyMock.verify(mockActionInvocation);
-	}
-	
-	public void testParseAndEncode() throws Exception {
-		ValueStack stack = ValueStackFactory.getFactory().createValueStack();
-		stack.push(new ActionSupport() {
-			public String getMyLocation() {
-				return "/myPage?param=value&param1=value1";
-			}
-		});
-		
-		ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
-		mockActionInvocation.getStack();
-		EasyMock.expectLastCall().andReturn(stack);
-		EasyMock.replay(mockActionInvocation);
-		
-		InternalStrutsResultSupport result = new InternalStrutsResultSupport();
-		result.setParse(true);
-		result.setEncode(true);
-		result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
-		
-		result.execute(mockActionInvocation);
-		
-		assertNotNull(result.getInternalLocation());
-		assertEquals("/pages/myJsp.jsp?location=%2FmyPage%3Fparam%3Dvalue%26param1%3Dvalue1", result.getInternalLocation());
-		EasyMock.verify(mockActionInvocation);
-	}
-	
-	
-	public void testNoParseAndEncode() throws Exception {
-		ValueStack stack = ValueStackFactory.getFactory().createValueStack();
-		stack.push(new ActionSupport() {
-			public String getMyLocation() {
-				return "myLocation.jsp";
-			}
-		});
-		
-		ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
-		EasyMock.replay(mockActionInvocation);
-		
-		InternalStrutsResultSupport result = new InternalStrutsResultSupport();
-		result.setParse(false);
-		result.setEncode(false); // don't really need this, as encode is only valid when parse is true.
-		result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
-		
-		result.execute(mockActionInvocation);
-		
-		assertNotNull(result.getInternalLocation());
-		assertEquals("/pages/myJsp.jsp?location=${myLocation}", result.getInternalLocation());
-		EasyMock.verify(mockActionInvocation);
-	}
-	
-	
-	public static class InternalStrutsResultSupport extends StrutsResultSupport {
-		private String _internalLocation = null;
-		
-		protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
-			_internalLocation = finalLocation;
-		}
-		
-		public String getInternalLocation() {
-			return _internalLocation;
-		}
-	}
+
+    public void testParse() throws Exception {
+        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        stack.push(new ActionSupport() {
+            public String getMyLocation() {
+                return "ThisIsMyLocation";
+            }
+        });
+
+        ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
+        mockActionInvocation.getStack();
+        EasyMock.expectLastCall().andReturn(stack);
+        EasyMock.replay(mockActionInvocation);
+
+        InternalStrutsResultSupport result = new InternalStrutsResultSupport();
+        result.setParse(true);
+        result.setEncode(false);
+        result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
+
+        result.execute(mockActionInvocation);
+
+        assertNotNull(result.getInternalLocation());
+        assertEquals("/pages/myJsp.jsp?location=ThisIsMyLocation", result.getInternalLocation());
+        EasyMock.verify(mockActionInvocation);
+    }
+
+    public void testParseAndEncode() throws Exception {
+        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        stack.push(new ActionSupport() {
+            public String getMyLocation() {
+                return "/myPage?param=value&param1=value1";
+            }
+        });
+
+        ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
+        mockActionInvocation.getStack();
+        EasyMock.expectLastCall().andReturn(stack);
+        EasyMock.replay(mockActionInvocation);
+
+        InternalStrutsResultSupport result = new InternalStrutsResultSupport();
+        result.setParse(true);
+        result.setEncode(true);
+        result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
+
+        result.execute(mockActionInvocation);
+
+        assertNotNull(result.getInternalLocation());
+        assertEquals("/pages/myJsp.jsp?location=%2FmyPage%3Fparam%3Dvalue%26param1%3Dvalue1", result.getInternalLocation());
+        EasyMock.verify(mockActionInvocation);
+    }
+
+
+    public void testNoParseAndEncode() throws Exception {
+        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        stack.push(new ActionSupport() {
+            public String getMyLocation() {
+                return "myLocation.jsp";
+            }
+        });
+
+        ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
+        EasyMock.replay(mockActionInvocation);
+
+        InternalStrutsResultSupport result = new InternalStrutsResultSupport();
+        result.setParse(false);
+        result.setEncode(false); // don't really need this, as encode is only valid when parse is true.
+        result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
+
+        result.execute(mockActionInvocation);
+
+        assertNotNull(result.getInternalLocation());
+        assertEquals("/pages/myJsp.jsp?location=${myLocation}", result.getInternalLocation());
+        EasyMock.verify(mockActionInvocation);
+    }
+
+
+    public static class InternalStrutsResultSupport extends StrutsResultSupport {
+        private String _internalLocation = null;
+
+        protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
+            _internalLocation = finalLocation;
+        }
+
+        public String getInternalLocation() {
+            return _internalLocation;
+        }
+    }
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher;
 
@@ -33,7 +36,7 @@
 
 
 /**
- * 
+ *
  */
 public class VelocityResultTest extends TestCase {
 
@@ -116,10 +119,10 @@
     }
 
     class TestResult extends StrutsResultSupport {
-    	
-		private static final long serialVersionUID = -1512206785088317315L;
-		
-		public String finalLocation;
+
+        private static final long serialVersionUID = -1512206785088317315L;
+
+        public String finalLocation;
 
         protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
             this.finalLocation = finalLocation;

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
- * $Id: ActionMapper.java 449367 2006-09-24 06:49:04Z mrdon $
+ * $Id: $
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher.mapper;
 
@@ -34,314 +37,314 @@
 import junit.framework.TestCase;
 
 /**
- * 
+ *
  * @version $Date$ $Id$
  */
 public class CompositeActionMapperTest extends TestCase {
-	
-	/**
-	 * Test with empty settings (settings with no entries of interest)
-	 * 
-	 * @throws Exception
-	 */
-	public void testGetOrderActionMapperEntries1() throws Exception {
-		CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
-		List<IndividualActionMapperEntry> result = 
-			compositeActionMapper.getOrderedActionMapperEntries();
-		
-		assertEquals(result.size(), 0);
-	}
-	
-	/**
-	 * Test with a normal settings.
-	 * 
-	 * @throws Exception
-	 */
-	public void testGetOrderActionMapperEntries2() throws Exception {
-		CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
-		
-		Settings old = Settings.getInstance();
-		try {
-			Settings.setInstance(new InnerSettings());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
-		
-			List<IndividualActionMapperEntry> result = 
-				compositeActionMapper.getOrderedActionMapperEntries();
-		
-			assertEquals(result.size(), 3);
-			
-			IndividualActionMapperEntry e = null;
-			Iterator<IndividualActionMapperEntry> i = result.iterator();
-			
-			// 1
-			e = i.next();
-			
-			assertEquals(e.order, new Integer(1));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
-			assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
-			
-			// 2
-			e = i.next();
-			
-			assertEquals(e.order, new Integer(2));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2");
-			assertEquals(e.propertyValue, InnerActionMapper2.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class);
-			
-			// 3
-			e = i.next();
-			assertEquals(e.order, new Integer(3));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
-			assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
-		}
-		finally {
-			Settings.setInstance(old);
-		}
-	}
-	
-	/**
-	 * Test with settings where entries are out-of-order, it needs to be able to retrieve them
-	 * back in proper order.
-	 * 
-	 * @throws Exception
-	 */
-	public void testGetOrderActionMapperEntries3() throws Exception {
-		CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
-		
-		Settings old = Settings.getInstance();
-		try {
-			Settings.setInstance(new InnerSettings());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
-		
-			List<IndividualActionMapperEntry> result = 
-				compositeActionMapper.getOrderedActionMapperEntries();
-		
-			assertEquals(result.size(), 3);
-			
-			IndividualActionMapperEntry e = null;
-			Iterator<IndividualActionMapperEntry> i = result.iterator();
-			
-			// 1
-			e = i.next();
-			
-			assertEquals(e.order, new Integer(1));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
-			assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
-			
-			// 2
-			e = i.next();
-			
-			assertEquals(e.order, new Integer(2));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2");
-			assertEquals(e.propertyValue, InnerActionMapper2.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class);
-			
-			// 3
-			e = i.next();
-			assertEquals(e.order, new Integer(3));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
-			assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
-		}
-		finally {
-			Settings.setInstance(old);
-		}
-	}
-	
-	/**
-	 * Test with a bad entry
-	 * 
-	 * @throws Exception
-	 */
-	public void testGetOrderActionMapperEntries4() throws Exception {
-		CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
-		
-		Settings old = Settings.getInstance();
-		try {
-			Settings.setInstance(new InnerSettings());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"NotANumber", InnerActionMapper2.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
-		
-			List<IndividualActionMapperEntry> result = 
-				compositeActionMapper.getOrderedActionMapperEntries();
-		
-			assertEquals(result.size(), 2);
-			
-			IndividualActionMapperEntry e = null;
-			Iterator<IndividualActionMapperEntry> i = result.iterator();
-			
-			// 1
-			e = i.next();
-			
-			assertEquals(e.order, new Integer(1));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
-			assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
-			
-			// 2
-			e = i.next();
-			assertEquals(e.order, new Integer(3));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
-			assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
-		}
-		finally {
-			Settings.setInstance(old);
-		}
-	}
-	
-	/**
-	 * Test with an entry where the action mapper class is bogus.
-	 * @throws Exception
-	 */
-	public void testGetOrderActionMapperEntries5() throws Exception {
-		CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
-		
-		Settings old = Settings.getInstance();
-		try {
-			Settings.setInstance(new InnerSettings());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", "bogus.class.name");
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
-		
-			List<IndividualActionMapperEntry> result = 
-				compositeActionMapper.getOrderedActionMapperEntries();
-		
-			assertEquals(result.size(), 2);
-			
-			IndividualActionMapperEntry e = null;
-			Iterator<IndividualActionMapperEntry> i = result.iterator();
-			
-			// 1
-			e = i.next();
-			
-			assertEquals(e.order, new Integer(1));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
-			assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
-			
-			
-			// 2
-			e = i.next();
-			assertEquals(e.order, new Integer(3));
-			assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
-			assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
-			assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
-		}
-		finally {
-			Settings.setInstance(old);
-		}
-	}
-	
-	
-	
-	public void testGetActionMappingAndUri1() throws Exception {
-		CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
-		
-		Settings old = Settings.getInstance();
-		try {
-			Settings.setInstance(new InnerSettings());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
-		
-			
-			ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
-			String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
-			
-			assertNotNull(actionMapping);
-			assertNotNull(uri);
-			assertTrue(actionMapping == InnerActionMapper3.actionMapping);
-			assertTrue(uri == InnerActionMapper3.uri);
-		}
-		finally {
-			Settings.setInstance(old);
-		}
-	}
-	
-	public void testGetActionMappingAndUri2() throws Exception {
-		CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
-		
-		Settings old = Settings.getInstance();
-		try {
-			Settings.setInstance(new InnerSettings());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
-			Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
-		
-			
-			ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
-			String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
-			
-			assertNull(actionMapping);
-			assertNull(uri);
-		}
-		finally {
-			Settings.setInstance(old);
-		}
-	}
-	
-	
-	public static class InnerActionMapper1 implements ActionMapper {
-		public static ActionMapping actionMapping = new ActionMapping();
-		public static String uri="uri1";
-		
-		public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
-			return null;
-		}
-		public String getUriFromActionMapping(ActionMapping mapping) {
-			return null;
-		}
-	}
-	public static class InnerActionMapper2 implements ActionMapper {
-		public static ActionMapping actionMapping = new ActionMapping();
-		public static String uri="uri2";
-		
-		public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
-			return null;
-		}
-		public String getUriFromActionMapping(ActionMapping mapping) {
-			return null;
-		}
-	}
-	public static class InnerActionMapper3 implements ActionMapper {
-		public static ActionMapping actionMapping = new ActionMapping();
-		public static String uri = "uri3";
-		
-		public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
-			return actionMapping;
-		}
-		public String getUriFromActionMapping(ActionMapping mapping) {
-			return uri;
-		}
-	}
-	
-	class InnerSettings extends Settings {
-		private Map<String, String> _impl = new LinkedHashMap<String, String>();
-		
-		@Override
-		public boolean isSetImpl(String name) {
-			return _impl.containsKey(name);
-		}
-		@Override
-		public void setImpl(String name, String value) throws IllegalArgumentException, UnsupportedOperationException {
-			_impl.put(name, value);
-		}
-		@Override
-		public String getImpl(String name) throws IllegalArgumentException {
-			return (String) _impl.get(name);
-		}
-		@Override
-		public Iterator listImpl() {
-			return _impl.keySet().iterator();
-		}
-	}
-	
+
+    /**
+     * Test with empty settings (settings with no entries of interest)
+     *
+     * @throws Exception
+     */
+    public void testGetOrderActionMapperEntries1() throws Exception {
+        CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
+        List<IndividualActionMapperEntry> result =
+            compositeActionMapper.getOrderedActionMapperEntries();
+
+        assertEquals(result.size(), 0);
+    }
+
+    /**
+     * Test with a normal settings.
+     *
+     * @throws Exception
+     */
+    public void testGetOrderActionMapperEntries2() throws Exception {
+        CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
+
+        Settings old = Settings.getInstance();
+        try {
+            Settings.setInstance(new InnerSettings());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
+
+            List<IndividualActionMapperEntry> result =
+                compositeActionMapper.getOrderedActionMapperEntries();
+
+            assertEquals(result.size(), 3);
+
+            IndividualActionMapperEntry e = null;
+            Iterator<IndividualActionMapperEntry> i = result.iterator();
+
+            // 1
+            e = i.next();
+
+            assertEquals(e.order, new Integer(1));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
+            assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
+
+            // 2
+            e = i.next();
+
+            assertEquals(e.order, new Integer(2));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2");
+            assertEquals(e.propertyValue, InnerActionMapper2.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class);
+
+            // 3
+            e = i.next();
+            assertEquals(e.order, new Integer(3));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
+            assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
+        }
+        finally {
+            Settings.setInstance(old);
+        }
+    }
+
+    /**
+     * Test with settings where entries are out-of-order, it needs to be able to retrieve them
+     * back in proper order.
+     *
+     * @throws Exception
+     */
+    public void testGetOrderActionMapperEntries3() throws Exception {
+        CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
+
+        Settings old = Settings.getInstance();
+        try {
+            Settings.setInstance(new InnerSettings());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
+
+            List<IndividualActionMapperEntry> result =
+                compositeActionMapper.getOrderedActionMapperEntries();
+
+            assertEquals(result.size(), 3);
+
+            IndividualActionMapperEntry e = null;
+            Iterator<IndividualActionMapperEntry> i = result.iterator();
+
+            // 1
+            e = i.next();
+
+            assertEquals(e.order, new Integer(1));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
+            assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
+
+            // 2
+            e = i.next();
+
+            assertEquals(e.order, new Integer(2));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2");
+            assertEquals(e.propertyValue, InnerActionMapper2.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class);
+
+            // 3
+            e = i.next();
+            assertEquals(e.order, new Integer(3));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
+            assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
+        }
+        finally {
+            Settings.setInstance(old);
+        }
+    }
+
+    /**
+     * Test with a bad entry
+     *
+     * @throws Exception
+     */
+    public void testGetOrderActionMapperEntries4() throws Exception {
+        CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
+
+        Settings old = Settings.getInstance();
+        try {
+            Settings.setInstance(new InnerSettings());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"NotANumber", InnerActionMapper2.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
+
+            List<IndividualActionMapperEntry> result =
+                compositeActionMapper.getOrderedActionMapperEntries();
+
+            assertEquals(result.size(), 2);
+
+            IndividualActionMapperEntry e = null;
+            Iterator<IndividualActionMapperEntry> i = result.iterator();
+
+            // 1
+            e = i.next();
+
+            assertEquals(e.order, new Integer(1));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
+            assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
+
+            // 2
+            e = i.next();
+            assertEquals(e.order, new Integer(3));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
+            assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
+        }
+        finally {
+            Settings.setInstance(old);
+        }
+    }
+
+    /**
+     * Test with an entry where the action mapper class is bogus.
+     * @throws Exception
+     */
+    public void testGetOrderActionMapperEntries5() throws Exception {
+        CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
+
+        Settings old = Settings.getInstance();
+        try {
+            Settings.setInstance(new InnerSettings());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", "bogus.class.name");
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
+
+            List<IndividualActionMapperEntry> result =
+                compositeActionMapper.getOrderedActionMapperEntries();
+
+            assertEquals(result.size(), 2);
+
+            IndividualActionMapperEntry e = null;
+            Iterator<IndividualActionMapperEntry> i = result.iterator();
+
+            // 1
+            e = i.next();
+
+            assertEquals(e.order, new Integer(1));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1");
+            assertEquals(e.propertyValue, InnerActionMapper1.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class);
+
+
+            // 2
+            e = i.next();
+            assertEquals(e.order, new Integer(3));
+            assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3");
+            assertEquals(e.propertyValue, InnerActionMapper3.class.getName());
+            assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class);
+        }
+        finally {
+            Settings.setInstance(old);
+        }
+    }
+
+
+
+    public void testGetActionMappingAndUri1() throws Exception {
+        CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
+
+        Settings old = Settings.getInstance();
+        try {
+            Settings.setInstance(new InnerSettings());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName());
+
+
+            ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
+            String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
+
+            assertNotNull(actionMapping);
+            assertNotNull(uri);
+            assertTrue(actionMapping == InnerActionMapper3.actionMapping);
+            assertTrue(uri == InnerActionMapper3.uri);
+        }
+        finally {
+            Settings.setInstance(old);
+        }
+    }
+
+    public void testGetActionMappingAndUri2() throws Exception {
+        CompositeActionMapper compositeActionMapper = new CompositeActionMapper();
+
+        Settings old = Settings.getInstance();
+        try {
+            Settings.setInstance(new InnerSettings());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName());
+            Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName());
+
+
+            ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
+            String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
+
+            assertNull(actionMapping);
+            assertNull(uri);
+        }
+        finally {
+            Settings.setInstance(old);
+        }
+    }
+
+
+    public static class InnerActionMapper1 implements ActionMapper {
+        public static ActionMapping actionMapping = new ActionMapping();
+        public static String uri="uri1";
+
+        public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
+            return null;
+        }
+        public String getUriFromActionMapping(ActionMapping mapping) {
+            return null;
+        }
+    }
+    public static class InnerActionMapper2 implements ActionMapper {
+        public static ActionMapping actionMapping = new ActionMapping();
+        public static String uri="uri2";
+
+        public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
+            return null;
+        }
+        public String getUriFromActionMapping(ActionMapping mapping) {
+            return null;
+        }
+    }
+    public static class InnerActionMapper3 implements ActionMapper {
+        public static ActionMapping actionMapping = new ActionMapping();
+        public static String uri = "uri3";
+
+        public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
+            return actionMapping;
+        }
+        public String getUriFromActionMapping(ActionMapping mapping) {
+            return uri;
+        }
+    }
+
+    class InnerSettings extends Settings {
+        private Map<String, String> _impl = new LinkedHashMap<String, String>();
+
+        @Override
+        public boolean isSetImpl(String name) {
+            return _impl.containsKey(name);
+        }
+        @Override
+        public void setImpl(String name, String value) throws IllegalArgumentException, UnsupportedOperationException {
+            _impl.put(name, value);
+        }
+        @Override
+        public String getImpl(String name) throws IllegalArgumentException {
+            return (String) _impl.get(name);
+        }
+        @Override
+        public Iterator listImpl() {
+            return _impl.keySet().iterator();
+        }
+    }
+
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher.mapper;
 
@@ -48,7 +51,7 @@
         req = new MockHttpServletRequest();
         req.setupGetParameterMap(new HashMap());
         req.setupGetContextPath("/my/namespace");
-        
+
         config = new DefaultConfiguration();
         PackageConfig pkg = new PackageConfig("myns", "/my/namespace", false, null);
         PackageConfig pkg2 = new PackageConfig("my", "/my", false, null);
@@ -90,9 +93,9 @@
         assertEquals("actionName", mapping.getName());
         assertEquals("add", mapping.getMethod());
     }
-    
+
     public void testGetMappingWithSlashedName() throws Exception {
-        
+
         String old = Settings.get(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES);
         Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, "true");
         try {
@@ -112,7 +115,7 @@
         }
 
     }
-    
+
     public void testGetMappingWithUnknownNamespace() throws Exception {
         setUp();
         req.setupGetRequestURI("/bo/foo/actionName.action");
@@ -174,7 +177,7 @@
             org.apache.struts2.config.Settings.set(StrutsConstants.STRUTS_ACTION_EXTENSION, old);
         }
     }
-    
+
     // =============================
     // === test name & namespace ===
     // =============================
@@ -208,7 +211,7 @@
         assertEquals(actionMapping.getName(), "someAction");
         assertEquals(actionMapping.getNamespace(), "/my");
     }
-    
+
     public void testParseNameAndNamespace_NoSlashes() throws Exception {
         String old = Settings.get(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES);
         Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, "false");
@@ -225,7 +228,7 @@
             Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, old);
         }
     }
-    
+
     public void testParseNameAndNamespace_AllowSlashes() throws Exception {
         String old = Settings.get(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES);
         Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, "true");
@@ -297,15 +300,15 @@
 
         // TODO: need to test location but there's noaccess to the property/method, unless we use reflection
     }
-    
+
     public void testDropExtension() throws Exception {
         DefaultActionMapper mapper = new DefaultActionMapper();
         String name = mapper.dropExtension("foo.action");
         assertTrue("Name not right: "+name, "foo".equals(name));
-        
+
         name = mapper.dropExtension("foo.action.action");
         assertTrue("Name not right: "+name, "foo.action".equals(name));
-        
+
     }
 
     public void testGetUriFromActionMapper1() throws Exception {
@@ -416,7 +419,7 @@
 
         assertEquals("/myActionName.action?test=bla", uri);
     }
-    
+
     public void testGetUriFromActionMapper11() throws Exception {
         DefaultActionMapper mapper = new DefaultActionMapper();
         ActionMapping actionMapping = new ActionMapping();
@@ -426,7 +429,7 @@
 
         assertEquals("/myActionName.action", uri);
     }
-    
+
     public void testGetUriFromActionMapper12() throws Exception {
         DefaultActionMapper mapper = new DefaultActionMapper();
         ActionMapping actionMapping = new ActionMapping();

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
- * $Id: RestfulActionMapper.java 449367 2006-09-24 06:49:04Z mrdon $
+ * $Id: $
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher.mapper;
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java Mon Nov  6 07:01:43 2006
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
  *
- *      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.
+ * 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.struts2.dispatcher.mapper;
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/impl/MessagesTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/impl/MessagesTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/impl/MessagesTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/impl/MessagesTest.java Mon Nov  6 07:01:43 2006
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
 // Copyright 2006 Google Inc. All Rights Reserved.
 
 package org.apache.struts2.impl;



Mime
View raw message