|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -16,7 +16,10 @@
@@ -16,7 +16,10 @@
|
|
|
|
|
|
|
|
|
|
package org.springframework.aop.framework; |
|
|
|
|
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.sql.Savepoint; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import javax.accessibility.Accessible; |
|
|
|
|
@ -380,6 +383,40 @@ public class ProxyFactoryTests {
@@ -380,6 +383,40 @@ public class ProxyFactoryTests {
|
|
|
|
|
assertThat(proxy.getName()).isEqualTo("tb"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testCharSequenceProxy() { |
|
|
|
|
CharSequence target = "test"; |
|
|
|
|
ProxyFactory pf = new ProxyFactory(target); |
|
|
|
|
ClassLoader cl = target.getClass().getClassLoader(); |
|
|
|
|
assertThat(((CharSequence) pf.getProxy(cl)).toString()).isEqualTo(target); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testDateProxy() { |
|
|
|
|
Date target = new Date(); |
|
|
|
|
ProxyFactory pf = new ProxyFactory(target); |
|
|
|
|
pf.setProxyTargetClass(true); |
|
|
|
|
ClassLoader cl = target.getClass().getClassLoader(); |
|
|
|
|
assertThat(((Date) pf.getProxy(cl)).getTime()).isEqualTo(target.getTime()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testJdbcSavepointProxy() throws SQLException { |
|
|
|
|
Savepoint target = new Savepoint() { |
|
|
|
|
@Override |
|
|
|
|
public int getSavepointId() throws SQLException { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public String getSavepointName() throws SQLException { |
|
|
|
|
return "sp"; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
ProxyFactory pf = new ProxyFactory(target); |
|
|
|
|
ClassLoader cl = Savepoint.class.getClassLoader(); |
|
|
|
|
assertThat(((Savepoint) pf.getProxy(cl)).getSavepointName()).isEqualTo("sp"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Order(2) |
|
|
|
|
public static class A implements Runnable { |
|
|
|
|
@ -391,7 +428,7 @@ public class ProxyFactoryTests {
@@ -391,7 +428,7 @@ public class ProxyFactoryTests {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Order(1) |
|
|
|
|
public static class B implements Runnable{ |
|
|
|
|
public static class B implements Runnable { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
|