On 07/14/2009 03:42 PM, Naresh wrote:
> tarjei wrote:
>> Hi,
>>
>> Naresh, hero of the day, wrote:
>>> super();
>>> Map<String, String> contextParams = new HashMap<String, String>();
>>> contextParams.put("contextConfigLocation",
>>> "classpath:applicationContext-HSQLdb.xml");
>>> ApplicationDescriptor appDescriptor = new ApplicationDescriptor()
>>> .setContextPath(your-context-path)
>>>
>>> .setRootResourcePackageName(your-root-resource-package-name)
>>>
>>> .setServletClass(com.sun.jersey.spi.spring.container.servlet.SpringServlet.class)
>>>
>>>
>>>
>>> .setContextListenerClassName("org.springframework.web.context.ContextLoaderListener")
>>>
>>>
>>> .setContextParams(contextParams);
>>> super.setupTestEnvironment(appDescriptor);
>> Great!
>> That worked.
> Cool.
>> I guess this should go into the docs?
> I think I'll add it to the blog entry [1].
>
> [1] http://blogs.sun.com/naresh/entry/jersey_test_framework_makes_it
Great :)
While you're at it,maybe also add a comment that you can also exclude
the 18M glassfish dependency and still run the tests.
<dependency>
<groupId>com.sun.jersey.test.framework</groupId>
<artifactId>jersey-test-framework</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.glassfish.embedded</groupId>
<artifactId>glassfish-embedded-all</artifactId>
</exclusion>
</exclusions>
</dependency>
Again, thanks for helping.
Tarjei
>
> Thanks,
> Naresh
>>
>> Now I got another problem.
>>
>> I use the Webresource to do a request like this:
>> SourceView sv = new SourceView();
>> .. set some sv attributes ..
>> SourceView sv2 = webResource.path("source").put(SourceView.class, sv);
>>
>> and according to the logging, a request containing the correct XML is
>> generated and PUT to the server, but in my method I get a null instead
>> of the expected object.
>>
>> Any tips to why?
>>
>> The method signature looks like this:
>> @PUT
>> @Path("/")
>> @Consumes({
>> "application/xml",
>> "text/xml"})
>> public SourceView create(SourceView s) {
>> ...
>> }
>>
>>
>>
>> Kind regards,
>> Tarjei
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
--
Tarjei Huse
Mobil: 920 63 413