How should DI from hivemind work when dealing with classes and not
interfaces for service point?

I've to work with classes so refactoring is not an option.

I got a FruitBowl class which has this constructors:
   public FruitBowl()
    {
    }

    public FruitBowl(Fruit fruit[])
    {
        for (int i = 0; i < fruit.length; i++) {
            bowl.put(fruit[i].getClass(), fruit[i]);
        }
    }

    public FruitBowl(Apple apple, Banana banana)
    {
        bowl.put(apple.getClass(), apple);
        bowl.put(banana.getClass(), banana);
    }

And this getters/setters methods:
   public boolean hasApple()
    {
        return bowl.get(Apple.class) != null;
    }

    public boolean hasBanana()
    {
        return bowl.get(Banana.class) != null;
    }

    public Apple getApple()
    {
        return (Apple) bowl.get(Apple.class);
    }

    public void setApple(Apple apple)
    {
        bowl.put(apple.getClass(), apple);
    }

    public Banana getBanana()
    {
        return (Banana) bowl.get(Banana.class);
    }

    public void setBanana(Banana banana)
    {
        bowl.put(banana.getClass(), banana);
    }


Have Apple and Banana classes without a constructor and a hivemodule like this:
<module id="tck" version="1.0.0" package="org.mule.tck.testmodels.fruit">
    <service-point id="Apple" interface="Apple">
     <invoke-factory>
      <construct class="Apple"/>
     </invoke-factory>
    </service-point>
    <service-point id="Banana" interface="Banana">
     <invoke-factory>
      <construct class="Banana"/>
     </invoke-factory>
    </service-point>
    <service-point id="FruitBowl" interface="FruitBowl">
      <invoke-factory>
        <construct class="FruitBowl">
         <service>Apple</service>
         <service>Banana</service>
        </construct>
      </invoke-factory>
    </service-point>
</module>

I've already tried different ways of injecting deps like construct
based with service and object nested element of <construct> without
any luck

As you can see this is a test case to make pass the Mule ESB test
suite to add support for HiveMind container context (to use HiveMind
services within Mule descriptors)
Inside the test it fails when assertTrue(fruitBowl.hasApple()).

The code is there, just need help to pass this test.

Regards
--
Massimo
http://meridio.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to