Java源码示例:org.springframework.aop.interceptor.ExposeInvocationInterceptor
示例1
/**
* Add special advisors if necessary to work with a proxy chain that contains AspectJ advisors:
* concretely, {@link ExposeInvocationInterceptor} at the beginning of the list.
* <p>This will expose the current Spring AOP invocation (necessary for some AspectJ pointcut
* matching) and make available the current AspectJ JoinPoint. The call will have no effect
* if there are no AspectJ advisors in the advisor chain.
* @param advisors the advisors available
* @return {@code true} if an {@link ExposeInvocationInterceptor} was added to the list,
* otherwise {@code false}
*/
public static boolean makeAdvisorChainAspectJCapableIfNecessary(List<Advisor> advisors) {
// Don't add advisors to an empty list; may indicate that proxying is just not required
if (!advisors.isEmpty()) {
boolean foundAspectJAdvice = false;
for (Advisor advisor : advisors) {
// Be careful not to get the Advice without a guard, as this might eagerly
// instantiate a non-singleton AspectJ aspect...
if (isAspectJAdvice(advisor)) {
foundAspectJAdvice = true;
break;
}
}
if (foundAspectJAdvice && !advisors.contains(ExposeInvocationInterceptor.ADVISOR)) {
advisors.add(0, ExposeInvocationInterceptor.ADVISOR);
return true;
}
}
return false;
}
示例2
protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
ProxyFactory pf = new ProxyFactory(target);
if (interfaces.length > 1 || interfaces[0].isInterface()) {
pf.setInterfaces(interfaces);
}
else {
pf.setProxyTargetClass(true);
}
// Required everywhere we use AspectJ proxies
pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pf.addAdvisors(advisors);
pf.setExposeProxy(true);
return pf.getProxy();
}
示例3
@Test
public void testCanGetStaticPartFromJoinPoint() {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
assertEquals(ProceedingJoinPoint.METHOD_EXECUTION, staticPart.getKind());
assertSame(AbstractAspectJAdvice.currentJoinPoint().getSignature(), staticPart.getSignature());
assertEquals(AbstractAspectJAdvice.currentJoinPoint().getSourceLocation(), staticPart.getSourceLocation());
}
});
ITestBean itb = (ITestBean) pf.getProxy();
// Any call will do
itb.getAge();
}
示例4
@Test
public void testTargetCanGetInvocation() throws Throwable {
final InvocationCheckExposedInvocationTestBean expectedTarget = new InvocationCheckExposedInvocationTestBean();
AdvisedSupport pc = new AdvisedSupport(ITestBean.class, IOther.class);
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
TrapTargetInterceptor tii = new TrapTargetInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
// Assert that target matches BEFORE invocation returns
assertEquals("Target is correct", expectedTarget, invocation.getThis());
return super.invoke(invocation);
}
};
pc.addAdvice(tii);
pc.setTarget(expectedTarget);
AopProxy aop = createAopProxy(pc);
ITestBean tb = (ITestBean) aop.getProxy();
tb.getName();
}
示例5
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
String task = "get invocation on way IN";
try {
MethodInvocation current = ExposeInvocationInterceptor.currentInvocation();
assertEquals(mi.getMethod(), current.getMethod());
Object retval = mi.proceed();
task = "get invocation on way OUT";
assertEquals(current, ExposeInvocationInterceptor.currentInvocation());
return retval;
}
catch (IllegalStateException ex) {
System.err.println(task + " for " + mi.getMethod());
ex.printStackTrace();
throw ex;
}
}
示例6
/**
* Add special advisors if necessary to work with a proxy chain that contains AspectJ advisors.
* This will expose the current Spring AOP invocation (necessary for some AspectJ pointcut matching)
* and make available the current AspectJ JoinPoint. The call will have no effect if there are no
* AspectJ advisors in the advisor chain.
* @param advisors the advisors available
* @return {@code true} if any special {@link Advisor Advisors} were added, otherwise {@code false}
*/
public static boolean makeAdvisorChainAspectJCapableIfNecessary(List<Advisor> advisors) {
// Don't add advisors to an empty list; may indicate that proxying is just not required
if (!advisors.isEmpty()) {
boolean foundAspectJAdvice = false;
for (Advisor advisor : advisors) {
// Be careful not to get the Advice without a guard, as
// this might eagerly instantiate a non-singleton AspectJ aspect
if (isAspectJAdvice(advisor)) {
foundAspectJAdvice = true;
}
}
if (foundAspectJAdvice && !advisors.contains(ExposeInvocationInterceptor.ADVISOR)) {
advisors.add(0, ExposeInvocationInterceptor.ADVISOR);
return true;
}
}
return false;
}
示例7
protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
ProxyFactory pf = new ProxyFactory(target);
if (interfaces.length > 1 || interfaces[0].isInterface()) {
pf.setInterfaces(interfaces);
}
else {
pf.setProxyTargetClass(true);
}
// Required everywhere we use AspectJ proxies
pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pf.addAdvisors(advisors);
pf.setExposeProxy(true);
return pf.getProxy();
}
示例8
@Test
public void testCanGetStaticPartFromJoinPoint() {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
assertEquals(ProceedingJoinPoint.METHOD_EXECUTION, staticPart.getKind());
assertSame(AbstractAspectJAdvice.currentJoinPoint().getSignature(), staticPart.getSignature());
assertEquals(AbstractAspectJAdvice.currentJoinPoint().getSourceLocation(), staticPart.getSourceLocation());
}
});
ITestBean itb = (ITestBean) pf.getProxy();
// Any call will do
itb.getAge();
}
示例9
@Test
public void testTargetCanGetInvocation() throws Throwable {
final InvocationCheckExposedInvocationTestBean expectedTarget = new InvocationCheckExposedInvocationTestBean();
AdvisedSupport pc = new AdvisedSupport(ITestBean.class, IOther.class);
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
TrapTargetInterceptor tii = new TrapTargetInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
// Assert that target matches BEFORE invocation returns
assertEquals("Target is correct", expectedTarget, invocation.getThis());
return super.invoke(invocation);
}
};
pc.addAdvice(tii);
pc.setTarget(expectedTarget);
AopProxy aop = createAopProxy(pc);
ITestBean tb = (ITestBean) aop.getProxy();
tb.getName();
}
示例10
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
String task = "get invocation on way IN";
try {
MethodInvocation current = ExposeInvocationInterceptor.currentInvocation();
assertEquals(mi.getMethod(), current.getMethod());
Object retval = mi.proceed();
task = "get invocation on way OUT";
assertEquals(current, ExposeInvocationInterceptor.currentInvocation());
return retval;
}
catch (IllegalStateException ex) {
System.err.println(task + " for " + mi.getMethod());
ex.printStackTrace();
throw ex;
}
}
示例11
/**
* Add special advisors if necessary to work with a proxy chain that contains AspectJ advisors.
* This will expose the current Spring AOP invocation (necessary for some AspectJ pointcut matching)
* and make available the current AspectJ JoinPoint. The call will have no effect if there are no
* AspectJ advisors in the advisor chain.
* @param advisors Advisors available
* @return {@code true} if any special {@link Advisor Advisors} were added, otherwise {@code false}.
*/
public static boolean makeAdvisorChainAspectJCapableIfNecessary(List<Advisor> advisors) {
// Don't add advisors to an empty list; may indicate that proxying is just not required
if (!advisors.isEmpty()) {
boolean foundAspectJAdvice = false;
for (Advisor advisor : advisors) {
// Be careful not to get the Advice without a guard, as
// this might eagerly instantiate a non-singleton AspectJ aspect
if (isAspectJAdvice(advisor)) {
foundAspectJAdvice = true;
}
}
if (foundAspectJAdvice && !advisors.contains(ExposeInvocationInterceptor.ADVISOR)) {
advisors.add(0, ExposeInvocationInterceptor.ADVISOR);
return true;
}
}
return false;
}
示例12
/**
* Add special advisors if necessary to work with a proxy chain that contains AspectJ advisors.
* This will expose the current Spring AOP invocation (necessary for some AspectJ pointcut matching)
* and make available the current AspectJ JoinPoint. The call will have no effect if there are no
* AspectJ advisors in the advisor chain.
* @param advisors Advisors available
* @return {@code true} if any special {@link Advisor Advisors} were added, otherwise {@code false}.
*/
public static boolean makeAdvisorChainAspectJCapableIfNecessary(List<Advisor> advisors) {
// Don't add advisors to an empty list; may indicate that proxying is just not required
if (!advisors.isEmpty()) {
boolean foundAspectJAdvice = false;
for (Advisor advisor : advisors) {
// Be careful not to get the Advice without a guard, as
// this might eagerly instantiate a non-singleton AspectJ aspect
if (isAspectJAdvice(advisor)) {
foundAspectJAdvice = true;
}
}
if (foundAspectJAdvice && !advisors.contains(ExposeInvocationInterceptor.ADVISOR)) {
advisors.add(0, ExposeInvocationInterceptor.ADVISOR);
return true;
}
}
return false;
}
示例13
protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
ProxyFactory pf = new ProxyFactory(target);
if (interfaces.length > 1 || interfaces[0].isInterface()) {
pf.setInterfaces(interfaces);
}
else {
pf.setProxyTargetClass(true);
}
// Required everywhere we use AspectJ proxies
pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);
for (Object a : advisors) {
pf.addAdvisor((Advisor) a);
}
pf.setExposeProxy(true);
return pf.getProxy();
}
示例14
@Test
public void testCanGetStaticPartFromJoinPoint() {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
assertEquals(ProceedingJoinPoint.METHOD_EXECUTION, staticPart.getKind());
assertSame(AbstractAspectJAdvice.currentJoinPoint().getSignature(), staticPart.getSignature());
assertEquals(AbstractAspectJAdvice.currentJoinPoint().getSourceLocation(), staticPart.getSourceLocation());
}
});
ITestBean itb = (ITestBean) pf.getProxy();
// Any call will do
itb.getAge();
}
示例15
@Test
public void testTargetCanGetInvocation() throws Throwable {
final InvocationCheckExposedInvocationTestBean expectedTarget = new InvocationCheckExposedInvocationTestBean();
AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class, IOther.class});
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
TrapTargetInterceptor tii = new TrapTargetInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
// Assert that target matches BEFORE invocation returns
assertEquals("Target is correct", expectedTarget, invocation.getThis());
return super.invoke(invocation);
}
};
pc.addAdvice(tii);
pc.setTarget(expectedTarget);
AopProxy aop = createAopProxy(pc);
ITestBean tb = (ITestBean) aop.getProxy();
tb.getName();
}
示例16
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
String task = "get invocation on way IN";
try {
MethodInvocation current = ExposeInvocationInterceptor.currentInvocation();
assertEquals(mi.getMethod(), current.getMethod());
Object retval = mi.proceed();
task = "get invocation on way OUT";
assertEquals(current, ExposeInvocationInterceptor.currentInvocation());
return retval;
}
catch (IllegalStateException ex) {
System.err.println(task + " for " + mi.getMethod());
ex.printStackTrace();
throw ex;
}
}
示例17
protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
ProxyFactory pf = new ProxyFactory(target);
if (interfaces.length > 1 || interfaces[0].isInterface()) {
pf.setInterfaces(interfaces);
}
else {
pf.setProxyTargetClass(true);
}
// Required everywhere we use AspectJ proxies
pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);
for (Object a : advisors) {
pf.addAdvisor((Advisor) a);
}
pf.setExposeProxy(true);
return pf.getProxy();
}
示例18
@Override
public CodelessDao getObject() {
ProxyFactory result = new ProxyFactory();
result.setTarget(codelessDaoProxy);
result.setInterfaces(CodelessDao.class, SpringProxy.class);
result.addAdvice(SurroundingTransactionDetectorMethodInterceptor.INSTANCE);
result.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
result.addAdvice(new DefaultMethodInvokingMethodInterceptor());
return (CodelessDao)result.getProxy(classLoader);
}
示例19
/**
* Lazily instantiate joinpoint for the current invocation.
* Requires MethodInvocation to be bound with ExposeInvocationInterceptor.
* <p>Do not use if access is available to the current ReflectiveMethodInvocation
* (in an around advice).
* @return current AspectJ joinpoint, or through an exception if we're not in a
* Spring AOP invocation.
*/
public static JoinPoint currentJoinPoint() {
MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation();
if (!(mi instanceof ProxyMethodInvocation)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
}
ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi;
JoinPoint jp = (JoinPoint) pmi.getUserAttribute(JOIN_POINT_KEY);
if (jp == null) {
jp = new MethodInvocationProceedingJoinPoint(pmi);
pmi.setUserAttribute(JOIN_POINT_KEY, jp);
}
return jp;
}
示例20
/**
* Get the current join point match at the join point we are being dispatched on.
*/
@Nullable
protected JoinPointMatch getJoinPointMatch() {
MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation();
if (!(mi instanceof ProxyMethodInvocation)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
}
return getJoinPointMatch((ProxyMethodInvocation) mi);
}
示例21
@Test
public void toShortAndLongStringFormedCorrectly() throws Exception {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
// makeEncSJP, although meant for computing the enclosing join point,
// it serves our purpose here
JoinPoint.StaticPart aspectJVersionJp = Factory.makeEncSJP(method);
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
assertEquals(aspectJVersionJp.getSignature().toLongString(), jp.getSignature().toLongString());
assertEquals(aspectJVersionJp.getSignature().toShortString(), jp.getSignature().toShortString());
assertEquals(aspectJVersionJp.getSignature().toString(), jp.getSignature().toString());
assertEquals(aspectJVersionJp.toLongString(), jp.toLongString());
assertEquals(aspectJVersionJp.toShortString(), jp.toShortString());
assertEquals(aspectJVersionJp.toString(), jp.toString());
}
});
ITestBean itb = (ITestBean) pf.getProxy();
itb.getAge();
itb.setName("foo");
itb.getDoctor();
itb.getStringArray();
itb.getSpouse();
itb.setSpouse(new TestBean());
try {
itb.unreliableFileOperation();
}
catch (IOException ex) {
// we don't really care...
}
}
示例22
/**
* Test that when we serialize and deserialize various canonical instances
* of AOP classes, they return the same instance, not a new instance
* that's subverted the singleton construction limitation.
*/
@Test
public void testCanonicalFrameworkClassesStillCanonicalOnDeserialization() throws Exception {
assertSame(MethodMatcher.TRUE, SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE));
assertSame(ClassFilter.TRUE, SerializationTestUtils.serializeAndDeserialize(ClassFilter.TRUE));
assertSame(Pointcut.TRUE, SerializationTestUtils.serializeAndDeserialize(Pointcut.TRUE));
assertSame(EmptyTargetSource.INSTANCE, SerializationTestUtils.serializeAndDeserialize(EmptyTargetSource.INSTANCE));
assertSame(Pointcuts.SETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.SETTERS));
assertSame(Pointcuts.GETTERS, SerializationTestUtils.serializeAndDeserialize(Pointcuts.GETTERS));
assertSame(ExposeInvocationInterceptor.INSTANCE,
SerializationTestUtils.serializeAndDeserialize(ExposeInvocationInterceptor.INSTANCE));
}
示例23
/**
* @param context if true, want context
*/
private void testContext(final boolean context) throws Throwable {
final String s = "foo";
// Test return value
MethodInterceptor mi = new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
if (!context) {
assertNoInvocationContext();
}
else {
assertNotNull("have context", ExposeInvocationInterceptor.currentInvocation());
}
return s;
}
};
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
if (context) {
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
}
pc.addAdvice(mi);
// Keep CGLIB happy
if (requiresTarget()) {
pc.setTarget(new TestBean());
}
AopProxy aop = createAopProxy(pc);
assertNoInvocationContext();
ITestBean tb = (ITestBean) aop.getProxy();
assertNoInvocationContext();
assertSame("correct return value", s, tb.getName());
}
示例24
@Test
public void testDeclaredException() throws Throwable {
final Exception expectedException = new Exception();
// Test return value
MethodInterceptor mi = new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
throw expectedException;
}
};
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pc.addAdvice(mi);
// We don't care about the object
mockTargetSource.setTarget(new TestBean());
pc.setTargetSource(mockTargetSource);
AopProxy aop = createAopProxy(pc);
try {
ITestBean tb = (ITestBean) aop.getProxy();
// Note: exception param below isn't used
tb.exceptional(expectedException);
fail("Should have thrown exception raised by interceptor");
}
catch (Exception thrown) {
assertEquals("exception matches", expectedException, thrown);
}
}
示例25
/**
* An interceptor throws a checked exception not on the method signature.
* For efficiency, we don't bother unifying java.lang.reflect and
* org.springframework.cglib UndeclaredThrowableException
*/
@Test
public void testUndeclaredCheckedException() throws Throwable {
final Exception unexpectedException = new Exception();
// Test return value
MethodInterceptor mi = new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
throw unexpectedException;
}
};
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pc.addAdvice(mi);
// We don't care about the object
pc.setTarget(new TestBean());
AopProxy aop = createAopProxy(pc);
ITestBean tb = (ITestBean) aop.getProxy();
try {
// Note: exception param below isn't used
tb.getAge();
fail("Should have wrapped exception raised by interceptor");
}
catch (UndeclaredThrowableException thrown) {
assertEquals("exception matches", unexpectedException, thrown.getUndeclaredThrowable());
}
catch (Exception ex) {
ex.printStackTrace();
fail("Didn't expect exception: " + ex);
}
}
示例26
@Test
public void testUndeclaredUncheckedException() throws Throwable {
final RuntimeException unexpectedException = new RuntimeException();
// Test return value
MethodInterceptor mi = new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
throw unexpectedException;
}
};
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pc.addAdvice(mi);
// We don't care about the object
pc.setTarget(new TestBean());
AopProxy aop = createAopProxy(pc);
ITestBean tb = (ITestBean) aop.getProxy();
try {
// Note: exception param below isn't used
tb.getAge();
fail("Should have wrapped exception raised by interceptor");
}
catch (RuntimeException thrown) {
assertEquals("exception matches", unexpectedException, thrown);
}
}
示例27
/**
* Throw an exception if there is an Invocation.
*/
private void assertNoInvocationContext() {
try {
ExposeInvocationInterceptor.currentInvocation();
fail("Expected no invocation context");
}
catch (IllegalStateException ex) {
// ok
}
}
示例28
/**
* Lazily instantiate joinpoint for the current invocation.
* Requires MethodInvocation to be bound with ExposeInvocationInterceptor.
* <p>Do not use if access is available to the current ReflectiveMethodInvocation
* (in an around advice).
* @return current AspectJ joinpoint, or through an exception if we're not in a
* Spring AOP invocation.
*/
public static JoinPoint currentJoinPoint() {
MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation();
if (!(mi instanceof ProxyMethodInvocation)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
}
ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi;
JoinPoint jp = (JoinPoint) pmi.getUserAttribute(JOIN_POINT_KEY);
if (jp == null) {
jp = new MethodInvocationProceedingJoinPoint(pmi);
pmi.setUserAttribute(JOIN_POINT_KEY, jp);
}
return jp;
}
示例29
/**
* Get the current join point match at the join point we are being dispatched on.
*/
@Nullable
protected JoinPointMatch getJoinPointMatch() {
MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation();
if (!(mi instanceof ProxyMethodInvocation)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
}
return getJoinPointMatch((ProxyMethodInvocation) mi);
}
示例30
@Test
public void toShortAndLongStringFormedCorrectly() throws Exception {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
// makeEncSJP, although meant for computing the enclosing join point,
// it serves our purpose here
JoinPoint.StaticPart aspectJVersionJp = Factory.makeEncSJP(method);
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
assertEquals(aspectJVersionJp.getSignature().toLongString(), jp.getSignature().toLongString());
assertEquals(aspectJVersionJp.getSignature().toShortString(), jp.getSignature().toShortString());
assertEquals(aspectJVersionJp.getSignature().toString(), jp.getSignature().toString());
assertEquals(aspectJVersionJp.toLongString(), jp.toLongString());
assertEquals(aspectJVersionJp.toShortString(), jp.toShortString());
assertEquals(aspectJVersionJp.toString(), jp.toString());
}
});
ITestBean itb = (ITestBean) pf.getProxy();
itb.getAge();
itb.setName("foo");
itb.getDoctor();
itb.getStringArray();
itb.getSpouse();
itb.setSpouse(new TestBean());
try {
itb.unreliableFileOperation();
}
catch (IOException ex) {
// we don't really care...
}
}