struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carl ballantyne <carl.ballant...@cast-info.es>
Subject Re: StrutsSpringTestCase
Date Fri, 27 Nov 2009 14:31:42 GMT


I just found that I can actually include xml files directly via  
Spring. Guess I should RTFM first.

So I have created a myapp-application-test.xml which contains:

	<import resource="myapp-application.xml"/>
	<import resource="myapp-datasource-test.xml"/>

Does the trick and clean enough. The Spring team say they prefer not  
to use this approach but since it is only for unit testing I don't see  
a big issue with it.

Cheers,
Carl.


Quoting carl ballantyne <carl.ballantyne@cast-info.es>:

> Hi Guys,
>
> I have the following spring bean definition files:
> myapp-application.xml
> myapp-datasource.xml
> myapp-datasource-test.xml
>
> When unit testing I want to use myapp-application.xml and
> myapp-datasource-test.xml. In the real world I want to use
> myapp-application.xml and myapp-datasource.xml.
>
> I have setup a base struts unit test class that overrides the
> getContextLocations method with the following.
>
> 	protected String getContextLocations() {
>         return "file:WebContent/WEB-INF/myapp-*.xml";
>
> 	}
>
> All good and it actually works fine for me. However I have another
> developer who is using Windows (I am using Linux - yay for me) and he
> is getting database connection errors. When I remove the
> myapp-datasource.xml file it works for him. Strange.
>
> Has anyone else run into something like this and if so how did you get
> around it? I would really like something like in the Spring JUnit
> helper classes which I use for testing the Spring beans.
>
> protected String[] getConfigLocations() {
>         return new String[] {
> "file:WebContent/WEB-INF/myapp-datasource-test.xml",
> "file:WebContent/WEB-INF/myapp-application.xml"
>     };
> 	}
>
> I don't want to have to make a myapp-application.xml and a
> myapp-application-test.xml as that seems like it would introduce bigger
> problems. Although I could probably get that to work with the pattern
> myapp-*-test.xml I only want to have alternate test xml files for the
> things that change in the testing environment.
>
> Cheers,
> Carl.
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org




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


Mime
View raw message