Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Replacing a dynamic list of arguments



Serge,

Using reflection in playback mode is your best bet because you can't use
thisJoinPoint with proceed(). To get the argument types you need use
thisJoinPoint.getParameterTypes().

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

"Serge Beaumont" <serge.beaumont@xxxxxxxxx>@eclipse.org on 22/12/2004
14:30:08

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    <aspectj-users@xxxxxxxxxxx>
cc:
Subject:    [aspectj-users] Replacing a dynamic list of arguments


Hello,

I am creating a framework for "record and playback" regression testing. In
the "record" part I use around advice and XStream (Websphere 4 runtime is
JDK 1.3... no 1.4 XMLEncoder, alas) to serialize thisJoinPoint.getArgs()
and
the return value from proceed(). So far, so good, works like a charm.

What I can't figure out is how I can take the deserialized Object array and
pass it to the method in "playback mode". You only seem to be able to pass
in arguments if you use args(something) in your pointcut, but that's not
generic enough, this forces me to think up all the signatures I neatly
avoided in the record part...

I tried args(Object[]) and args(), and that doesn't work, no method matched
anymore (don't have any Object[] params) but I tried to be sure, to see if
there wasn't a special case...

I tried setting values in the Object[] from thisJoinPoint.getArgs(), by
simply doing thisJoinPoint.getArgs()[0] = "Dummy value", but that doesn't
have any effect.

I guess I'm stuck with using reflection to get at the method and invoking
it
instead of using proceed(). Still trying to figure out how to create the
Class[] array I need for
thisJoinPoint.getTarget().getClass().getDeclaredMethod(methodName, Class[]
paramTypes)...

Does anybody have a suggestion? Is there some AspectJ thingy that does what
I want?

Thx,

Serge.




Serge Beaumont

Technisch Architect
Sogeti Nederland B.V.
T  +31  (0)20 660 66 00 + nakiesnummer 0391
serge.beaumont@xxxxxxxxx
www.sogeti.nl




Disclaimer:
This message contains information that may be privileged or confidential
and is the property of Sogeti Nederland B.V. or its Group members. It is
intended only for the person to whom it is addressed. If you are not the
intended recipient, you are not authorized to read, print, retain, copy,
disseminate, distribute, or use this message or any part thereof. If you
receive this message in error, please notify the sender immediately and
delete all copies of this message.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top