I've added a new package to the easymock library called "ext" to allow for a external system hooks to be bundled with easymock.

The first of these is the Transfer extension which adds the TransferMockFactory. TransferMockFactory is capable of building mock objects containing all the functions that the TransferObject contains, along with any Decorator functions. Best part is, it used the transfer configuration file in your application to do so. No more hard-wiring or manually injecting to build out a mock object when using Transfer.

First off, let me say that this is still beta code, as far as the easymock.ext.transfer package is concerned. The easymock package has been slightly modified to work with reflect.Injector objects when called from the createInjectedXXXMock() functions.

I am assuming that very few people, and by very few I mean zero, were ever using the createInjectedXXXMock() functions anyway.

A few notes on the TranferMockFactory. - ... is not an extension of easymock.MockFactory and TransferMockFactory is NOT a static class. It does have state. The init() method requires two parameters: the path to the tranfer.xml configuration file (relative to the root) and the absolute path to the root. You can have more than one TransferMockFactory depending on your application configuration. - ...uses Transfer objects to create the metadata for the TransferObject, then converts that to the component metadata for FUNCTIONS. - ...makes use of reflect v2.5 (included with this version of CFEasyMock) which introduced a newInjectedProxyInstance() to clean up the code. - ... returns a mock with a type of either or the decorator component listed in the transfer.xml configuration for that object. - ... doesn't currently implement the ParentOneToMany concept. Will hopefully post an update on this soon.

It would be nice to have options for creating the TransferMockFactory, such as passing in the Configuration component from Transfer to keep from having to duplicate file location code. Hopefully in a future release. I would greatly appreciate feedback on this.

For more detail see the documentation included in the v1.5 download of CFEasyMock.

Jan's Gravatar Very interesting. You are definitely smart and a very good professional. I am very glad that i found your post. It is very informative.

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