CFEasyMock and ColdSpring/Transfer

Starting a new job and integrating cfEM into an application using ColdSpring and Transfer. The ColdSpring piece is actually quite easy, however the Transfer portion is rather interesting, since Transfer doesn't require you to actually code a component. I will keep you posted.

For ColdSpring, I have created a separate coldspring.xml file for each test file, with the naming convention "TestFile.coldspring.xml". This allows me to wire the dependencies separately for each test.

As you can see, the MockFactory can easily be wired to produce the desired mock objects.

<beans default-autowire="byName">
<bean id="mockFactory" class="easymock.MockFactory" />

<bean id="transactionAPIGateway" factory-bean="mockFactory" factory-method="createMock">
<constructor-arg name="class">
<value>cfc.am.gateway.TransactionAPIGateway</value>
</constructor-arg>
</bean>
   
<bean id="identitySyncGateway" factory-bean="mockFactory" factory-method="createMock">
<constructor-arg name="class">
<value>cfc.am.gateway.IdentitySyncGateway</value>
</constructor-arg>
</bean>
   
<bean id="transactionAPIService" class="cfc.am.service.TransactionAPIService">
<property name="transactionAPIGateway">
<ref bean="transactionAPIGateway" />
</property>
<property name="syncGateway">
<ref bean="syncGateway" />
</property>
</bean>
</beans>

Comments
Cookie's Gravatar Very interesting indeed! Thanks a lot for posting the script! it is very useful.

://www.rochiiseara.net/
# Posted By Cookie | 4/18/12 6:19 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.5.006. | Protected by Akismet | Blog with WordPress