-
15. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 16, 2007 7:15 PM (in response to eagleeye)Here it is
<components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:web="http://jboss.com/products/seam/web" xmlns:spring="http://jboss.com/products/seam/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd http://jboss.com/products/seam/web http://jboss.com/products/seam/web-1.2.xsd http://jboss.com/products/seam/spring http://jboss.com/products/seam/spring-1.2.xsd"> <core:manager conversation-timeout="120000" concurrent-request-timeout="500" conversation-id-parameter="cid" conversation-is-long-running-parameter="clr"/> <core:ejb installed="true" /> <spring:context-loader /> </components>
-
16. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 16, 2007 7:35 PM (in response to eagleeye)I tried to see if the Spring Bean is resolved.
package test.testNG; import org.jboss.seam.mock.SeamTest; import org.testng.annotations.Test; public class InjectionTestNG extends SeamTest{ @Test public void testInjection() throws Exception { new FacesRequest(){ @Override protected void updateModelValues(){ setValue("#{departmentSpring.departmentName}","Department"); } }.run(); } }
And it throws exceptionFAILED: testInjection javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'departmentSpring' at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:52) at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:75) at com.sun.el.parser.AstValue.getTarget(AstValue.java:67) at com.sun.el.parser.AstValue.setValue(AstValue.java:147) at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:258) at org.jboss.seam.util.UnifiedELValueBinding.setValue(UnifiedELValueBinding.java:44) at org.jboss.seam.mock.SeamTest$Request.setValue(SeamTest.java:374) at test.testNG.InjectionTestNG$1.updateModelValues(InjectionTestNG.java:19) at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:476) at test.testNG.InjectionTestNG.testInjection(InjectionTestNG.java:21) ... Removed 22 stack frames
-
17. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 17, 2007 1:26 PM (in response to eagleeye)Could anyone please reply with some ideas as to why this exception is happening.
The Spring beans are not resolved in integration testing when invoked through EL. I have the DelegatingVariableResolver in place. -
18. Re: Integration Testing with TestNG and embeddedEjb
youngm Oct 17, 2007 2:23 PM (in response to eagleeye)I have no ideas why it is not working because it should be working. As soon as I get some time I'll get your example running and see if I can duplicate the problem.
-
19. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 17, 2007 4:02 PM (in response to eagleeye)Could it be possible that the DelegatingVariableResolver is not getting loaded?
-
20. Re: Integration Testing with TestNG and embeddedEjb
youngm Oct 17, 2007 4:08 PM (in response to eagleeye)the DelegatingVariableResolver isn't used in integration tests. The Spring integration is supposed to be loading automatically an ELResolver for use when not in a JSF request. Which is the situation for integration tests.
-
21. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 17, 2007 4:20 PM (in response to eagleeye)ok, so maybe that ELResolver is not resolving the Spring bean names.
I was trying to test a user interaction scenario, trying to set the bean values and add it to the DB. But the injection is not working as the ELResolver cannot resolve the Spring bean identifiers. Totally stuck at this point. :( -
22. Re: Integration Testing with TestNG and embeddedEjb
youngm Oct 17, 2007 5:22 PM (in response to eagleeye)Well, your testcase works for me.....are you sure your /WEB-INF folder which holds your component.xml file is in your classpath when you run the test?
-
23. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 18, 2007 12:21 PM (in response to eagleeye)Yes it is.
I am getting all my components installed on running the test case. And the test case works for components testing also. Its just the Spring bean is not resolved. ELResolver throws the exception. -
24. Re: Integration Testing with TestNG and embeddedEjb
youngm Oct 18, 2007 12:39 PM (in response to eagleeye)Yes it is.
I am getting all my components installed on running the test case. And the test case works for components testing also. Its just the Spring bean is not resolved. ELResolver throws the exception.
Just asking because I get the exact same error as you if my WEB-INF is not in the classpath when running the test.
Otherwise I cannot duplicate it....can you can send me an exact copy of your environment? A zipped eclipse project with all your dependencies or a project that I can just run ant or maven to duplicate the error?
youngm -at- gmail dot com -
25. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 18, 2007 5:36 PM (in response to eagleeye)Sure, I will send over my project environment to you.
Thanks... -
26. Re: Integration Testing with TestNG and embeddedEjb
b.reeve Oct 22, 2007 3:26 PM (in response to eagleeye)This issue is resolved. I didn't have jboss-seam-ioc.jar file in my classpath (not mentioned in the document). Here is the resolution.
Seam-Spring integration :- Spring framework integration module of Seam requires the jboss-seam-ioc.jar file to be in the classpath. The Spring bean injection would work otherwise also if you have the DelegatingVariableResolver configured in faces-config.xml. But the spring:context-loader component won't work without the ioc jar and the spring context wont be loaded at all unless you have the ContextLoaderListener configured in the web.xml). -
27. Re: Integration Testing with TestNG and embeddedEjb
youngm Oct 22, 2007 3:38 PM (in response to eagleeye)updated the docs to include a note about the jboss-seam-ioc dependency.
Thanks -
28. Re: Integration Testing with TestNG and embeddedEjb
dheerajsega Nov 19, 2007 12:29 PM (in response to eagleeye)I am also facing the same error.Can anyone help to resolve the error obtained during testing.
-
29. Re: Integration Testing with TestNG and embeddedEjb
dheerajsega Nov 19, 2007 12:33 PM (in response to eagleeye)Can anyone tell me from where I should download the
jboss-seam-ioc.jar file and place it