struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From isharatbabu <sarat.b...@fiserv.co.in>
Subject Struts 2 Unit test for Session.
Date Mon, 17 Sep 2007 09:31:14 GMT

Hello all,

I have created a java bean called person. i am accessing that java bean from
applicationcontext.xml where bean scope is set as session.

applicationcontext.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

<bean id="person1" class="org.apache.struts2.showcase.person.Person1" />
	
	<!--  a simple session-scoped bean -->
	<bean id="person" class="org.apache.struts2.showcase.person.Person"
scope="session">
		<property name="person1" ref="person1" />
	</bean>

</beans>


i am able to acess the "person" bean, set the bean values in session and
remove them successfully.
i got the object of the Person in  my Action class as simply writing :

Person person; 


i want to do the same in Junit test cases, without creating the new instance
of the person.which i was able to do in actions.

I want to know how to access the applicationcontext.xml attributes in Junit
test cases with out application server running.

Please respond soon.
I have deadline for the project. thanks in anticipation.


-- 
View this message in context: http://www.nabble.com/Struts-2-Unit-test-for-Session.-tf4465519.html#a12732508
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message