From: Jerome F. <fi...@vi...> - 2003-05-05 18:32:23
|
Well actually you can load java.io.File in your own classloader. Maybe there is a limitation in JMangler. But it's possible. You can load a class in the original system loader and call a specific method that will create our own classloader and then load the classes needed. We must pay attention to how junit works as well.... Let's spike! :) Vincent Tencé wrote: >Been thinking about Mockry 2 this week-end. > >I looked at AspectWerkz, JMangler and the Dynamic Mocks from mock objects. >We have very powerfull tools in hands and most of the funtionality is >already there: > >1. The dynamic mock framework looks like 95% reusable. They have the >concepts of mocks, expectations, parameters, return values, ... We can reuse >95% of their code base. All we have to change is the Mock class that uses >JDK1.3 proxies to do the job. > >2. AspectWerkz (using JMangler) brings the tools to modify classes & >interfaces at the methods & fields level. > >There still are some things to work out though. First, I don't know yet if >we can use AspectWerkz using an API. All I've seen atm is configuration >files. > >Secondly, JMangler cannot modify classes from rt.jar. JP was right and >classloading mechanism works this way: > >1. Classes always ask the ClassLoader that loaded them to load any of their >dependent classes, and >2. ClassLoaders always delegate up the delegation tree to see if their >"parent" ClassLoaders wish to load the class first. > >All classes in rt.jar will be loaded by the bootstrap classloader. Of >course, the bootstrap classloader is located in the VM and written in native >code. > >However, I think we can get around this. What if we don't try to modify, say >String.class, but modify the class that uses String.class and make it use >MockString.class instead. I think that's how Agile Test from Polygenix does >it. Not sure thouhgt. I think all we need to do is ensure binary >compatibility of the MockString over String. Then we modify MockString using >AspectWerkz and make our class under test use MockString instead. Thoughts? > >-- Vincent > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Mockry-developer mailing list >Moc...@li... >https://lists.sourceforge.net/lists/listinfo/mockry-developer > > > |