<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Unit Testing Struts 2 Actions wired with Spring using JUnit</title>
	<atom:link href="http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/feed/" rel="self" type="application/rss+xml" />
	<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/</link>
	<description>Because programming is depressing</description>
	<lastBuildDate>Thu, 05 Nov 2009 23:29:15 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Arindam Ray</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1040</link>
		<dc:creator>Arindam Ray</dc:creator>
		<pubDate>Tue, 06 Oct 2009 13:41:08 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1040</guid>
		<description>I have got the answer.

Complete BaseStrutsTestCase is like following:

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ActionProxyFactory;
import junit.framework.TestCase;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.tiles.StrutsTilesListener;
import org.apache.struts2.views.JspSupportServlet;
import org.apache.tiles.impl.BasicTilesContainer;
import org.springframework.context.ApplicationContext;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletConfig;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.ContextLoader;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletContextEvent;

/**
 * @author Arindam Ray
 */
@SuppressWarnings(&quot;unchecked&quot;)
public abstract class BaseStrutsTestCase extends TestCase {
	private static final String CONTEXT_CONFIG_LOCATION = &quot;/WEB-INF/applicationContext.xml,&quot; +
	&quot;/WEB-INF/dataAccessContext.xml&quot;;
	
	private static final String TILES_DEFINITIONS = &quot;/WEB-INF/tiles.xml&quot;;
	
	private static ApplicationContext applicationContext;
	private Dispatcher dispatcher;
	protected ActionProxy proxy;
	protected static MockServletContext servletContext;
	protected MockHttpServletRequest request;
	protected MockHttpServletResponse response;

	public BaseStrutsTestCase(String name) {
		super(name);
	}

	/**
	 * Created action class based on namespace and name
	 * @param clazz Class for which to create Action
	 * @param namespace Namespace of action
	 * @param name Action name
	 * @param parameters Request parameters
	 * @param session Session map
	 * @return Action class
	 * @throws Exception Catch-all exception
	 */
	protected Object createAction(Class clazz, String namespace, String name, Map parameters, Map session)
	throws Exception {

		// create a proxy class which is just a wrapper around the action call.
		// The proxy is created by checking the namespace and name against the
		// struts.xml configuration
		proxy = dispatcher.getContainer().getInstance(ActionProxyFactory.class).createActionProxy(namespace, name, null, true, false);

		ActionContext actionContext = proxy.getInvocation().getInvocationContext();
		
		if(parameters == null) {
			// by default, don&#039;t pass in any request parameters
			actionContext.setParameters(new HashMap());
		}
		else {
			//set the parameters
			actionContext.setParameters(parameters);
		}

		if(session == null) {
			actionContext.setSession(new HashMap());
		}
		else {
			//set the session
			actionContext.setSession(session);
		}

		// do not execute the result after executing the action
		proxy.setExecuteResult(true);

		// set the actions context to the one which the proxy is using
		ServletActionContext.setContext(actionContext);
		request = new MockHttpServletRequest();
		response = new MockHttpServletResponse();
		ServletActionContext.setRequest(request);
		ServletActionContext.setResponse(response);
		ServletActionContext.setServletContext(servletContext);
		return proxy.getAction();
	}

	protected void setUp() throws Exception {
		if( applicationContext == null ) {
			// this is the first time so initialize Spring context
			servletContext = new MockServletContext();
			servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, CONTEXT_CONFIG_LOCATION);
			applicationContext = (new ContextLoader()).initWebApplicationContext(servletContext);

			// Struts JSP support servlet (for Freemarker)
			new JspSupportServlet().init(new MockServletConfig(servletContext));
			
			//for tiles
			servletContext.addInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG, TILES_DEFINITIONS);
			final StrutsTilesListener tilesListener = new StrutsTilesListener();
			final ServletContextEvent event = new ServletContextEvent(servletContext);
			tilesListener.contextInitialized(event);
		}
		// Dispatcher is the guy that actually handles all requests.  Pass in
		// an empty. Map as the parameters but if you want to change stuff like
		// what config files to read, you need to specify them here.  Here&#039;s how to
		// scan packages for actions (thanks to Hardy Ferentschik - Comment 66)
		// (see Dispatcher&#039;s source code)
		HashMap params = new HashMap();
		params.put(&quot;actionPackages&quot;, &quot;gc.action&quot;);
		dispatcher = new Dispatcher(servletContext, params);
		dispatcher.init();
		Dispatcher.setInstance(dispatcher);
	}
}</description>
		<content:encoded><![CDATA[<p>I have got the answer.</p>
<p>Complete BaseStrutsTestCase is like following:</p>
<p>import com.opensymphony.xwork2.ActionContext;<br />
import com.opensymphony.xwork2.ActionProxy;<br />
import com.opensymphony.xwork2.ActionProxyFactory;<br />
import junit.framework.TestCase;<br />
import org.apache.struts2.ServletActionContext;<br />
import org.apache.struts2.dispatcher.Dispatcher;<br />
import org.apache.struts2.tiles.StrutsTilesListener;<br />
import org.apache.struts2.views.JspSupportServlet;<br />
import org.apache.tiles.impl.BasicTilesContainer;<br />
import org.springframework.context.ApplicationContext;<br />
import org.springframework.mock.web.MockHttpServletRequest;<br />
import org.springframework.mock.web.MockHttpServletResponse;<br />
import org.springframework.mock.web.MockServletConfig;<br />
import org.springframework.mock.web.MockServletContext;<br />
import org.springframework.web.context.ContextLoader;</p>
<p>import java.util.HashMap;<br />
import java.util.Map;</p>
<p>import javax.servlet.ServletContextEvent;</p>
<p>/**<br />
 * @author Arindam Ray<br />
 */<br />
@SuppressWarnings(&#8220;unchecked&#8221;)<br />
public abstract class BaseStrutsTestCase extends TestCase {<br />
	private static final String CONTEXT_CONFIG_LOCATION = &#8220;/WEB-INF/applicationContext.xml,&#8221; +<br />
	&#8220;/WEB-INF/dataAccessContext.xml&#8221;;</p>
<p>	private static final String TILES_DEFINITIONS = &#8220;/WEB-INF/tiles.xml&#8221;;</p>
<p>	private static ApplicationContext applicationContext;<br />
	private Dispatcher dispatcher;<br />
	protected ActionProxy proxy;<br />
	protected static MockServletContext servletContext;<br />
	protected MockHttpServletRequest request;<br />
	protected MockHttpServletResponse response;</p>
<p>	public BaseStrutsTestCase(String name) {<br />
		super(name);<br />
	}</p>
<p>	/**<br />
	 * Created action class based on namespace and name<br />
	 * @param clazz Class for which to create Action<br />
	 * @param namespace Namespace of action<br />
	 * @param name Action name<br />
	 * @param parameters Request parameters<br />
	 * @param session Session map<br />
	 * @return Action class<br />
	 * @throws Exception Catch-all exception<br />
	 */<br />
	protected Object createAction(Class clazz, String namespace, String name, Map parameters, Map session)<br />
	throws Exception {</p>
<p>		// create a proxy class which is just a wrapper around the action call.<br />
		// The proxy is created by checking the namespace and name against the<br />
		// struts.xml configuration<br />
		proxy = dispatcher.getContainer().getInstance(ActionProxyFactory.class).createActionProxy(namespace, name, null, true, false);</p>
<p>		ActionContext actionContext = proxy.getInvocation().getInvocationContext();</p>
<p>		if(parameters == null) {<br />
			// by default, don&#8217;t pass in any request parameters<br />
			actionContext.setParameters(new HashMap());<br />
		}<br />
		else {<br />
			//set the parameters<br />
			actionContext.setParameters(parameters);<br />
		}</p>
<p>		if(session == null) {<br />
			actionContext.setSession(new HashMap());<br />
		}<br />
		else {<br />
			//set the session<br />
			actionContext.setSession(session);<br />
		}</p>
<p>		// do not execute the result after executing the action<br />
		proxy.setExecuteResult(true);</p>
<p>		// set the actions context to the one which the proxy is using<br />
		ServletActionContext.setContext(actionContext);<br />
		request = new MockHttpServletRequest();<br />
		response = new MockHttpServletResponse();<br />
		ServletActionContext.setRequest(request);<br />
		ServletActionContext.setResponse(response);<br />
		ServletActionContext.setServletContext(servletContext);<br />
		return proxy.getAction();<br />
	}</p>
<p>	protected void setUp() throws Exception {<br />
		if( applicationContext == null ) {<br />
			// this is the first time so initialize Spring context<br />
			servletContext = new MockServletContext();<br />
			servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, CONTEXT_CONFIG_LOCATION);<br />
			applicationContext = (new ContextLoader()).initWebApplicationContext(servletContext);</p>
<p>			// Struts JSP support servlet (for Freemarker)<br />
			new JspSupportServlet().init(new MockServletConfig(servletContext));</p>
<p>			//for tiles<br />
			servletContext.addInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG, TILES_DEFINITIONS);<br />
			final StrutsTilesListener tilesListener = new StrutsTilesListener();<br />
			final ServletContextEvent event = new ServletContextEvent(servletContext);<br />
			tilesListener.contextInitialized(event);<br />
		}<br />
		// Dispatcher is the guy that actually handles all requests.  Pass in<br />
		// an empty. Map as the parameters but if you want to change stuff like<br />
		// what config files to read, you need to specify them here.  Here&#8217;s how to<br />
		// scan packages for actions (thanks to Hardy Ferentschik &#8211; Comment 66)<br />
		// (see Dispatcher&#8217;s source code)<br />
		HashMap params = new HashMap();<br />
		params.put(&#8220;actionPackages&#8221;, &#8220;gc.action&#8221;);<br />
		dispatcher = new Dispatcher(servletContext, params);<br />
		dispatcher.init();<br />
		Dispatcher.setInstance(dispatcher);<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arindam Ray</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1039</link>
		<dc:creator>Arindam Ray</dc:creator>
		<pubDate>Tue, 06 Oct 2009 13:38:36 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1039</guid>
		<description>use like this:

private static final String CONFIG_LOCATIONS =
“/WEB-INF/web.xml,”+ “/hibernate.cfg.xml,” + “/aplicationContext-dao.xml,” + “/applicationContext-resources.xml,” + “/applicationContext-service.xml,” + “/applicationContext-struts.xml”;</description>
		<content:encoded><![CDATA[<p>use like this:</p>
<p>private static final String CONFIG_LOCATIONS =<br />
“/WEB-INF/web.xml,”+ “/hibernate.cfg.xml,” + “/aplicationContext-dao.xml,” + “/applicationContext-resources.xml,” + “/applicationContext-service.xml,” + “/applicationContext-struts.xml”;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arindam Ray</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1038</link>
		<dc:creator>Arindam Ray</dc:creator>
		<pubDate>Tue, 06 Oct 2009 10:24:46 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1038</guid>
		<description>can you pls tell me what to do when action returns a tiles type result??</description>
		<content:encoded><![CDATA[<p>can you pls tell me what to do when action returns a tiles type result??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arindam Ray</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1037</link>
		<dc:creator>Arindam Ray</dc:creator>
		<pubDate>Tue, 06 Oct 2009 10:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1037</guid>
		<description>I am also having the same problem...Can anyone pls help me?...</description>
		<content:encoded><![CDATA[<p>I am also having the same problem&#8230;Can anyone pls help me?&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arindam Ray</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1036</link>
		<dc:creator>Arindam Ray</dc:creator>
		<pubDate>Tue, 06 Oct 2009 10:12:48 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1036</guid>
		<description>have you got any solution for loading web.xml??</description>
		<content:encoded><![CDATA[<p>have you got any solution for loading web.xml??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arindam Ray</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1035</link>
		<dc:creator>Arindam Ray</dc:creator>
		<pubDate>Tue, 06 Oct 2009 09:49:32 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1035</guid>
		<description>I am getting the following error:

java.lang.NullPointerException
	at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)
	at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
	at gc.test.unittest.testaction.TestLoginActionUsingBaseStrutsTestCase.testInterceptorsBySettingRequestParameters(TestLoginActionUsingBaseStrutsTestCase.java:54)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:91)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)</description>
		<content:encoded><![CDATA[<p>I am getting the following error:</p>
<p>java.lang.NullPointerException<br />
	at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)<br />
	at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)<br />
	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)<br />
	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)<br />
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)<br />
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)<br />
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)<br />
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)<br />
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)<br />
	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)<br />
	at gc.test.unittest.testaction.TestLoginActionUsingBaseStrutsTestCase.testInterceptorsBySettingRequestParameters(TestLoginActionUsingBaseStrutsTestCase.java:54)<br />
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br />
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br />
	at java.lang.reflect.Method.invoke(Unknown Source)<br />
	at junit.framework.TestCase.runTest(TestCase.java:168)<br />
	at junit.framework.TestCase.runBare(TestCase.java:134)<br />
	at junit.framework.TestResult$1.protect(TestResult.java:110)<br />
	at junit.framework.TestResult.runProtected(TestResult.java:128)<br />
	at junit.framework.TestResult.run(TestResult.java:113)<br />
	at junit.framework.TestCase.run(TestCase.java:124)<br />
	at junit.framework.TestSuite.runTest(TestSuite.java:232)<br />
	at junit.framework.TestSuite.run(TestSuite.java:227)<br />
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:91)<br />
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)<br />
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)<br />
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)<br />
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)<br />
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)<br />
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arsenalist</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1026</link>
		<dc:creator>Arsenalist</dc:creator>
		<pubDate>Fri, 04 Sep 2009 08:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1026</guid>
		<description>Sure Bruce, no problem.</description>
		<content:encoded><![CDATA[<p>Sure Bruce, no problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1024</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Thu, 03 Sep 2009 21:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-1024</guid>
		<description>Zarar - I modified your BaseStrutsTestCase class so that it works for testing a Struts 2 Action class that doesn&#039;t use Spring.  I&#039;d like to publish this code along with an example of how to use it on my blog (http://www.brucephillips.name/blog).  I&#039;ve cited your name and blog article in the code comments and also will cite your orignal work in the blog article.

Is is OK with you if I publish on my blog the modified BaseStrutsTestCase class I created based on your work?

Bruce Phillips</description>
		<content:encoded><![CDATA[<p>Zarar &#8211; I modified your BaseStrutsTestCase class so that it works for testing a Struts 2 Action class that doesn&#8217;t use Spring.  I&#8217;d like to publish this code along with an example of how to use it on my blog (<a href="http://www.brucephillips.name/blog)" rel="nofollow">http://www.brucephillips.name/blog)</a>.  I&#8217;ve cited your name and blog article in the code comments and also will cite your orignal work in the blog article.</p>
<p>Is is OK with you if I publish on my blog the modified BaseStrutsTestCase class I created based on your work?</p>
<p>Bruce Phillips</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dc</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-912</link>
		<dc:creator>dc</dc:creator>
		<pubDate>Mon, 20 Jul 2009 00:31:38 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-912</guid>
		<description>I was wondering if the problem with the aware interface (SessionAware) as described in comments 24 &amp; 25 was ever resolved.

I have recently started experimenting with this very helpful unit testing code and facing same issue.

Looks like the framework isn&#039;t setting a session object to my class implementing SessionAware. So, I call the setSession() method to set it myself. That happens before proxy.execute(), but when the time comes for proxy.execute(0 to run, it resets the session map to null.

The test passes with the option to by-pass the framework and test the action in an isolated function.

Not sure if this discussion is still active, but if anyone has any advice or solution on this issue, I would very interested in hearing it.

Many thanks.</description>
		<content:encoded><![CDATA[<p>I was wondering if the problem with the aware interface (SessionAware) as described in comments 24 &amp; 25 was ever resolved.</p>
<p>I have recently started experimenting with this very helpful unit testing code and facing same issue.</p>
<p>Looks like the framework isn&#8217;t setting a session object to my class implementing SessionAware. So, I call the setSession() method to set it myself. That happens before proxy.execute(), but when the time comes for proxy.execute(0 to run, it resets the session map to null.</p>
<p>The test passes with the option to by-pass the framework and test the action in an isolated function.</p>
<p>Not sure if this discussion is still active, but if anyone has any advice or solution on this issue, I would very interested in hearing it.</p>
<p>Many thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stanlick</title>
		<link>http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-879</link>
		<dc:creator>stanlick</dc:creator>
		<pubDate>Thu, 18 Jun 2009 19:54:41 +0000</pubDate>
		<guid isPermaLink="false">http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/#comment-879</guid>
		<description>For those of you who are using this base class to unit test your Struts 2 apps, have you encountered this requirement?

I have a web.xml listener placing an object in application scope using servletContext.setAttribute(foo,engine) and an interceptor expecting to locate it using actionInvocation.getStack().findValue(&quot;#attr.foo&quot;). 

In my unit test which subclasses BaseStrutsTestCase I am putting the engine in scope using proxy.getInvocation().getStack().set(&quot;foo&quot;, engine), however my interceptor is finding a null when it attempts to fetch it from the stack.  Is there something weird concerning the OgnlValueStack in this context?

Peace,
Scott</description>
		<content:encoded><![CDATA[<p>For those of you who are using this base class to unit test your Struts 2 apps, have you encountered this requirement?</p>
<p>I have a web.xml listener placing an object in application scope using servletContext.setAttribute(foo,engine) and an interceptor expecting to locate it using actionInvocation.getStack().findValue(&#8220;#attr.foo&#8221;). </p>
<p>In my unit test which subclasses BaseStrutsTestCase I am putting the engine in scope using proxy.getInvocation().getStack().set(&#8220;foo&#8221;, engine), however my interceptor is finding a null when it attempts to fetch it from the stack.  Is there something weird concerning the OgnlValueStack in this context?</p>
<p>Peace,<br />
Scott</p>
]]></content:encoded>
	</item>
</channel>
</rss>
