Paul Sandoz wrote:
> Hi,
>
> Thanks. That is odd it is as if it s treating all three class path
> declarations as one as the file:
>
> "applicationContext-HSQLdb.xml
> classpath:/applicationContext-service.xml
> classpath:/applicationContext-tx.xml"
That really sounds odd. All that the test framework does is, it adds
this context parameter "contextConfigLocation" with value
"applicationContext-HSQLdb.xml classpath:/applicationContext-service.xml
classpath:/applicationContext-tx.xml" to the Grizzly ServletAdapter.
By the way did you try running it with EmbeddedGF?
>
> Note that we have to break source compatibility with the
> test-framework for 1.1.2-ea-SNAPSHOT to clean up the API and
> implementation. Naresh can give further details,
As Paul said, we have made some major changes to the test framework in
1.1.2-ea-SNAPSHOT. I will see that the changes are properly documented.
Thanks,
Naresh
> and i will point you to the spring annotations sample unit test code:
>
> public class SpringAnnotationsWebAppTest extends JerseyTest {
>
> public SpringAnnotationsWebAppTest() throws Exception {
> super(new
> WebAppDescriptor.Builder("com.sun.jersey.samples.springannotations.resources.jerseymanaged")
>
> .contextPath("spring")
> .contextParam("contextConfigLocation",
> "classpath:applicationContext.xml")
> .servletClass(SpringServlet.class)
> .contextListenerClass(ContextLoaderListener.class)
> .build());
> }
>
> Hopefully you will agree the builder pattern is a bit cleaner
> (although i am sure there are additional methods we can add) and so is
> the contract between the concrete test and the super class JerseyTest.
>
> Paul.
>
>
> On Aug 18, 2009, at 3:41 PM, tarjei wrote:
>
>> Hi, I got a class that extends JerseyTest that had the following
>> configuration:
>>
>> public LocalResourceTest() throws Exception {
>> super();
>> System.setProperty("container.type", GRIZZLY_WEB_CONTAINER);
>> Map<String, String> contextParams = new HashMap<String,
>> String>();
>> contextParams.put("contextConfigLocation",
>> "classpath:/applicationContext-HSQLdb.xml" +
>> " classpath:/applicationContext-service.xml" +
>> " classpath:/applicationContext-tx.xml");
>> ApplicationDescriptor appDescriptor = new
>> ApplicationDescriptor()
>> .setContextPath("/")
>> .setRootResourcePackageName("com.mydomain")
>>
>> .setServletClass(com.sun.jersey.spi.spring.container.servlet.SpringServlet.class)
>>
>>
>> .setContextListenerClassName("org.springframework.web.context.ContextLoaderListener")
>>
>>
>> .setContextParams(contextParams);
>> super.setupTestEnvironment(appDescriptor);
>> }
>>
>> This works with 1.1.0-ea , but does not work with 1.1.1-ea. There I get:
>>
>> Caused by: java.io.FileNotFoundException: class path resource
>> [applicationContext-HSQLdb.xml
>> classpath:/applicationContext-service.xml
>> classpath:/applicationContext-tx.xml] cannot be opened because it
>> does not exist
>> at
>> org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
>>
>> at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
>>
>>
>> I guess this is something minor, but I thought I'd note it.
>>
>> Regards,
>> Tarjei
>>
>>
>> --
>> Tarjei Huse
>> Mobil: 920 63 413
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>