开发者

Easy way to switch a back and forth between a real and mock data service for a Flex 4 application?

I have a Flex 4 client application that is under development in parallel with the server back-end. I am use Mate's Moc开发者_如何学GokRemoteObject to provide a mock data service, but as the real data service comes on line, we'll want to run against that sometimes from Eclipse.

Is there a way to easily switch between the two without having to modify source code?

Based on my research it seems like Spring-Actionscript might work, but I really do not want to switch frameworks at this point if I don't have to.


What about to build some proxy or localhost server and during mocking run it on your machine.

In another words, just make your mockUp URL exactly like an external production server. If you are working in a team, make a VPN network btw.


I found a way to do it. They key was using the little known feature of Actionscript called conditional compilation. By setting a compile time flag, I was able to include the mock data source code and use the mock service objects instead of the real ones. Whenever I compile without the flag, all of the mock source code is excluded from the project because it is on a non-standard Maven build path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜