Announcement Announcement Module
Collapse
No announcement yet.
Register Mock Services Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Register Mock Services

    Hello,

    I have a question about the registration of beans in my test using serviceRegistry.registerBean(String beanName, Object bean).

    If I'm correct I can use the code above to register a stub. This stub will be used instead of my business code when I run my test.

    I don't know why but when I run my test my business code is used instead of my stub. Can someone help me with this problem?

    Below you can see a piece of my test code and the beans my flowdefinition uses:

    protected FlowDefinitionResource getFlowDefinitionResource()
    {
    return createFlowDefinitionResource(flowDir,"importServic eDesignflow.xml");
    }

    protected void registerMockServices(MockFlowServiceLocatorservice Registry)
    {
    serviceRegistry.registerBean("serviceDesignHandler ", new
    ServiceDesignHandlerStub());
    }

    =

    <bean id="importServiceDesignAction" class="nl.ict.sce.mgt.designmanagement.ImportServi ceDesignAction">

    <property name="formObjectClass" value="nl.ict.sce.mgt.designmanagement.ImportBacki ngBean">
    </property>

    <property name="formObjectName" value="importBackingBean">
    </property>

    <property name="serviceDesignHandler"> <ref bean="serviceDesignhandler"/>
    </property>
    </bean>

    <bean id="serviceDesignhandler" class="nl.ict.sce.mgt.designmanagement.ServiceDesignHandlerImpl">

    </bean>

    Thanks,

    Raoul

  • #2
    I don't know why but when I run my test my business code is used instead of my stub.
    Are you defining the "serviceDesignHandler" bean in an application context imported by the flow XML?
    If so, that's indeed a problem. I noticed the same thing a few weeks ago but have not yet had the time to fix the issue.

    Erwin

    Comment


    • #3
      I've created a JIRA issue to track this:
      http://opensource.atlassian.com/proj...browse/SWF-307

      Erwin

      Comment


      • #4
        Hey Erwin,

        Thanks for your reaction.
        What you said is exactly what I did.

        Now I no longer import the application context of the serviceHandler in my flow XML. Instead I import it in the context of the dispatcher servlet.
        It works now.

        I'm looking forward to the fix in the next release of SWF.

        Greetings

        Raoul

        Comment

        Working...
        X