1 2 3 Previous Next 32 Replies Latest reply on Nov 19, 2007 1:15 PM by youngm Go to original post
      • 15. Re: Integration Testing with TestNG and embeddedEjb
        b.reeve

        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

          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 exception

          FAILED: 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

            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

              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

                Could it be possible that the DelegatingVariableResolver is not getting loaded?

                • 20. Re: Integration Testing with TestNG and embeddedEjb
                  youngm

                  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

                    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

                      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

                        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

                           

                          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

                            Sure, I will send over my project environment to you.
                            Thanks...

                            • 26. Re: Integration Testing with TestNG and embeddedEjb
                              b.reeve

                              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

                                updated the docs to include a note about the jboss-seam-ioc dependency.

                                Thanks

                                • 28. Re: Integration Testing with TestNG and embeddedEjb
                                  dheerajsega

                                  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

                                    Can anyone tell me from where I should download the
                                    jboss-seam-ioc.jar file and place it