Hello,
I am using Seam 2.0.2.SP1, JBoss AS 4.2.2 GA and TestNG 5.8.
I am trying to test a web service (Seam component) implemented as a stateless session bean using TestNG. The test class inherits SeamTest and the test method uses a FacesRequest in order to call the WS.
I want to mock an application-scoped Seam component deployed in the same package as the WS.
I have tried to use the @Install and setting the precedence to Install.MOCK on a Seam component from the test package. This mock component inherits the Seam component I want to mock, as described in the Seam Reference 2.1.1 GA, section 35.2.1 - they have the same name and scope. The mock is not deployed on JBoss AS. Running a basic Seam test, I can see that the mock is returned after a Component.getInstance(...
) instead of the regular component. So far, so good.
My problem is that when debugging the WS during my tests, I see that my mock is nowhere present - the real Seam component is always injected, though I would expect to see the mock injected. I believe that there are 2 application contexts: one activated inside the Seam application deployed on JBoss AS and another one activated inside the embedded JBoss AS started by SeamTest, so my mock is only registered as a Seam component inside the second application context (I'm not very sure I got the right reason).
My question is how can I mock the component used by the WS ?
I appreciate any help.
Thank you very much.