12 Replies Latest reply on Mar 20, 2008 6:07 PM by alesj

    Field injection tests

    alesj

      OK, I've pretty much ran out of ideas what else to test with field injection.

      This are the following things that I've done:

      Reflection

      1) Nested bean property/field usage
      - BeanInfoUtilTestCase

      2) Running over all modes
      - BeanInfoUnitTestCase

      3) Access restriction
      - AccessRestrictionTestCase (needs fixing :-))

      Kernel

      1) BeanAccessMode introduciton
      - Bean(Factory)TestCase::testBean(Factory)WithAccessMode

      2) Field dependency via property injection
      - PropertyFieldDependency(2)TestCase
      - GenericBeanFactoryFieldPropertyDependency(2)TestCase

      3 ) Field callbacks
      - CallbackCollectionFields(2)TestCase

      4) Basic field annotation support
      - BasicFieldAnnotationSupportTestCase
      - SimpleFieldTestCase

      5) Field access restriction
      - FieldAccessTestCase

      6) AOP + field injection
      - FieldAccessTestCase (in AOP-MC-int)

      7) Preinstantiated collections and fields
      - PreInstantiatedFields(XML)TestCase

      If you have any other ideas - which I'm sure you have - let me know. ;-)

        • 1. Re: Field injection tests
          starksm64

          Field/method injection of beans from a custom BeanFactory using a bounded pool with both successful injection, and failure due to no pooled instances available.

          • 2. Re: Field injection tests
            alesj

             

            "scott.stark@jboss.org" wrote:
            Field/method injection of beans from a custom BeanFactory using a bounded pool with both successful injection, and failure due to no pooled instances available.

            Can you write this down in API or xml?


            • 3. Re: Field injection tests
              alesj

               

              "alesj" wrote:
              "scott.stark@jboss.org" wrote:
              Field/method injection of beans from a custom BeanFactory using a bounded pool with both successful injection, and failure due to no pooled instances available.

              Can you write this down in API or xml?

              Or any kind of pseudo code, so that I get a better feel for what you're looking for.

              • 4. Re: Field injection tests
                starksm64

                Its the xml I showed in this beanfactory extensions thread:
                http://www.jboss.com/index.html?module=bb&op=viewtopic&t=132158

                I checked in a test org.jboss.test.kernel.deployment.support.container.TestPooledBeanFactory with a simple bounded queue pool that is prefilled on first use.

                The disconnect between the xml and any current psuedo code is that there is a one to one association between the bean metadata/xml and the instances upon which injection happens.

                To exercise the pool exhaustion scenario, you have to create multiple instances of Bean2Type, injecting multiple instances of Bean1Type. This behavior is not part of the current mc core. The test needs to wire things up at the metadata level and then call the org.jboss.test.kernel.deployment.support.container.BeanContainer.getBean() multiple times to create the Bean2Type instances which should have new Bean1Type instances injected.

                • 5. Re: Field injection tests

                  I don't know what you are trying to do?

                  The pool is not supposed to be part of the MC.

                  As both Carlo and I said on the ejb3 list, all that is required is that the
                  BeanFactory gets injected into the pool which ejb3 will implement.
                  http://www.jboss.com/index.html?module=bb&op=viewtopic&t=131424&postdays=0&postorder=asc&start=10
                  in many different ways.

                  • 6. Re: Field injection tests
                    starksm64

                    Yes, I saw that. I'm just combining the pool with a custom bean factory to setup test usages to validate where the separation between the containers and the mc dependency layer is going to be.

                    I'll separate the pool in the support classes to mirror that usage as a starting point.

                    • 7. Re: Field injection tests
                      starksm64

                      See the updated org.jboss.test.kernel.deployment.support.container.* classes with BeanContainer, BeanPool, etc. I'll work on an example testcase around these as I have to get some things straight anyway.

                      • 8. Re: Field injection tests

                        Scott, can you leave this until after I do the Beta11 release tomorrow?

                        • 9. Re: Field injection tests
                          alesj

                           

                          "scott.stark@jboss.org" wrote:
                          See the updated org.jboss.test.kernel.deployment.support.container.* classes with BeanContainer, BeanPool, etc.

                          This BeanPool class looks pretty broken:
                           public synchronized T createBean()
                           throws Throwable
                           {
                           if(pool.size() == 0)
                           {
                           // Fill the pool
                           for(int n = 0; n < pool.size(); n ++)
                           {
                           T bean = (T) factory.createBean();
                           pool.put(bean);
                           }
                           }
                           return pool.take();
                           }
                          

                          The pool field is never instantiated - unless you're gonna do field injection.
                          And you have an if on size == 0, and then you iterate till size - which is 0.
                          OK, I know it's a test class. :-)

                          • 10. Re: Field injection tests
                            starksm64

                             

                            "adrian@jboss.org" wrote:
                            Scott, can you leave this until after I do the Beta11 release tomorrow?

                            Sure.


                            • 11. Re: Field injection tests
                              starksm64

                              Its just a sketch of what I want to wire up at this point. It will be in shape by tomorrow. I'll just email it to you when I done for the night.

                              • 12. Re: Field injection tests
                                alesj

                                 

                                "scott.stark@jboss.org" wrote:

                                I'll just email it to you when I done for the night.

                                Or you can just commit it, since it will no longer be 'Adrian's tomorrow' when you turn in for the night. :-)