Wednesday, July 28, 2010

How to convert Version 1 requests into V2 requests?

Scenerio: If existing application is using lot of  Version 1 requests that need to be converted into version 2 requests.

Solution: Write a wrapper over the existing V1 class. For example if you import some class org.version.Version1 and calling various methods like addHeader(), addData() etc, write a wrapper org.wrapper.Version1Wrapper and define all  methods present in org.version.Version1. Inside org.version.Version1Wrapper  call org.version.Version2 methods. Now do a Search and Replace in all your existing code such that org.version.Version1 should be replaced by org.version.Version1Wrapper. Write a well defined unit test case for the newly written org.version.VersionV1Wrapper class.

Advantages: Very less implementation and testing effort.

No comments:

Post a Comment