I want to simulate user behavior in an java application and I want to write method calls and parameters to a log file that i will read and make the same calls with.
I want to do this using reflection (java.lang.reflect.Proxy) to both write the file to a log and then read the log and make the calls. Is there a tool or way to
1.Write out to a log file a call to a method like this for example:
com.example.Order.doStuff(String a, int b)
2.Write out to a log file the contents of the return type with fields if it exists like this:
com.example.ReturnType [private fildname = contents]
3.Read this information and make the call above using reflection?
Thanks.
Look up AOP (Aspect Oriented Programming)
This will allow you to declare interceptors around methods and then you can simply use the interceptors to write to a log file.
Below is a sample executing code by reflection.
import java.lang.reflect.Method;