-
1. Re: How to create a Junit test cases for Jbossws cxf web service
asoldano Nov 24, 2010 4:13 AM (in response to hsemar)The org.jboss.wsf.test.JBossWSTest class is basically an extension of JUnit TestCase providing convenient methods for programmatically deploying/undeploying archives to JBoss AS leveraging its MainDeployer service (it's accessed through JMX) [btw, we might think about changing this to use Arquillian in the future]. You can write a testcase that extends JBossWSTest similarly to what we do for most of the jbossws integration tests. You'll still sit at client side though, of course, you can deploy an archive with an endpoint and try invoking it. Testing the webservice endpoint really comes to testing the invocation too.
If you want to validate the business logic of the method which is also a webservice method, then that testing should probably be un-related to ws. Depending on your endpoint class being a pojo or ejb3, you should probably properly instantiate it directly and verify it's business logic.
-
2. Re: How to create a Junit test cases for Jbossws cxf web service
asoldano Nov 24, 2010 4:16 AM (in response to hsemar)Also please note that in some situations you might find useful to leverage the Endpoint API for programmatically deploying an endpoint, instead of requesting the archive it comes with to be deployed.
http://download.oracle.com/javaee/6/api/javax/xml/ws/Endpoint.html#create%28java.lang.Object%29
http://download.oracle.com/javaee/6/api/javax/xml/ws/Endpoint.html#publish%28java.lang.String%29
-
3. Re: How to create a Junit test cases for Jbossws cxf web service
hsemar Nov 24, 2010 4:20 AM (in response to asoldano)Thank you Alessio, appreciate your response. Yes, it makes perfect sense to create junit against web service client.
I have just found that we can use spring todo the unit testing. http://myblog.shriharisc.com/2009/10/09/unit-testing-cxf-webservice-endpoints-using-spring-test-and-testng/
I might need to spend little more time to choose the implementaion.
-
4. Re: How to create a Junit test cases for Jbossws cxf web service
asoldano Nov 24, 2010 5:07 AM (in response to hsemar)Ramesh R wrote:
I have just found that we can use spring todo the unit testing. http://myblog.shriharisc.com/2009/10/09/unit-testing-cxf-webservice-endpoints-using-spring-test-and-testng/
For sure you can, it's just up to you to decide if you want to introduce that dependency and write the xml file for having the proxy injected in your test class, or simply do that directly in the test code.