I made a quick update to the CFC Stub Generator to support creating the proper dependencies in the ColdSpring XML file that it generates. This will only work when using a UML XMI file as the generation source. When you define an aggregation or composition relationship in the UML, the generator knows about these relationships and creates the ColdSpring XML accordingly. So, if you have a UML diagram like this:

The ColdSpring XML that gets generated would look like this:

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>	
	
	<bean id="Config" class="bookstore.components.beans.Config" />		
	<bean id="MockConfig" class="bookstore.components.beans.mock.MockConfig" />
	<bean id="AbstractService" class="bookstore.components.services.AbstractService">
		<property name="Config">	
			<ref bean="Config" />
		</property>
		<property name="SessionFacade">	
			<ref bean="SessionFacade" />
		</property>
	</bean>		
	<bean id="MockAbstractService" class="bookstore.components.services.mock.MockAbstractService" />
	<bean id="StoreService" class="bookstore.components.services.StoreService">
		<property name="StoreFactory">	
			<ref bean="StoreFactory" />
		</property>
	</bean>		
	<bean id="MockStoreService" class="bookstore.components.services.mock.MockStoreService" />
	<bean id="StoreFactory" class="bookstore.components.factories.StoreFactory" />		
	<bean id="MockStoreFactory" class="bookstore.components.factories.mock.MockStoreFactory" />
	<bean id="Membership" class="bookstore.components.businessobjects.Membership" />		
	<bean id="MockMembership" class="bookstore.components.businessobjects.mock.MockMembership" />
	<bean id="Product" class="bookstore.components.businessobjects.Product" />		
	<bean id="MockProduct" class="bookstore.components.businessobjects.mock.MockProduct" />
	<bean id="SessionFacade" class="bookstore.components.facades.SessionFacade" />		
	<bean id="MockSessionFacade" class="bookstore.components.facades.mock.MockSessionFacade" />
	
</beans>
		

As you can see, the bean dependencies that are created in the ColdSpring XML match the aggregation relationships defined in the UML. This is pretty handy if you plan to copy the ColdSpring XML that is used by the generated test suite in your real application. It also makes it easy to modify this XML to pass Mock objects into your components when creating your tests.

del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 9606 Views

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)

Comments are not allowed for this entry.