polish: leading spaces -> tabs across .aop and .testsuite bundles

This commit is contained in:
Chris Beams
2008-12-12 19:39:14 +00:00
parent b7cc5d2402
commit 04d3f984b1
50 changed files with 1873 additions and 1611 deletions

View File

@@ -238,19 +238,19 @@ public class AspectJAdviceParameterNameDiscovererTests {
}
@Test
public void testReferenceBinding() {
assertParameterNames(getMethod("onePrimitive"),"somepc(foo)",new String[] {"foo"});
}
public void testReferenceBinding() {
assertParameterNames(getMethod("onePrimitive"),"somepc(foo)",new String[] {"foo"});
}
@Test
public void testReferenceBindingWithAlternateTokenizations() {
assertParameterNames(getMethod("onePrimitive"),"call(bar *) && somepc(foo)",new String[] {"foo"});
assertParameterNames(getMethod("onePrimitive"),"somepc ( foo )",new String[] {"foo"});
assertParameterNames(getMethod("onePrimitive"),"somepc( foo)",new String[] {"foo"});
}
public void testReferenceBindingWithAlternateTokenizations() {
assertParameterNames(getMethod("onePrimitive"),"call(bar *) && somepc(foo)",new String[] {"foo"});
assertParameterNames(getMethod("onePrimitive"),"somepc ( foo )",new String[] {"foo"});
assertParameterNames(getMethod("onePrimitive"),"somepc( foo)",new String[] {"foo"});
}
protected Method getMethod(String name) {
protected Method getMethod(String name) {
// assumes no overloading of test methods...
Method[] candidates = this.getClass().getMethods();
for (int i = 0; i < candidates.length; i++) {

View File

@@ -29,7 +29,7 @@ import org.springframework.beans.TestBean;
*/
public class BeanNamePointcutMatchingTests {
@Test
@Test
public void testMatchingPointcuts() {
assertMatch("someName", "bean(someName)");
@@ -64,7 +64,7 @@ public class BeanNamePointcutMatchingTests {
assertMatch("someName", "bean(someName) && !bean(someOtherName)");
}
@Test
@Test
public void testNonMatchingPointcuts() {
assertMisMatch("someName", "bean(someNamex)");
assertMisMatch("someName", "bean(someX*Name)");
@@ -86,8 +86,8 @@ public class BeanNamePointcutMatchingTests {
matches(beanName, pcExpression));
}
private static boolean matches(final String beanName, String pcExpression) {
@SuppressWarnings("serial")
private static boolean matches(final String beanName, String pcExpression) {
@SuppressWarnings("serial")
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() {
protected String getCurrentProxiedBeanName() {
return beanName;

View File

@@ -42,8 +42,8 @@ import org.springframework.beans.TestBean;
* @since 2.0
*/
public class MethodInvocationProceedingJoinPointTests {
@Test
@Test
public void testingBindingWithJoinPoint() {
try {
AbstractAspectJAdvice.currentJoinPoint();
@@ -53,8 +53,8 @@ public class MethodInvocationProceedingJoinPointTests {
// expected
}
}
@Test
@Test
public void testingBindingWithProceedingJoinPoint() {
try {
AbstractAspectJAdvice.currentJoinPoint();
@@ -64,8 +64,8 @@ public class MethodInvocationProceedingJoinPointTests {
// expected
}
}
@Test
@Test
public void testCanGetMethodSignatureFromJoinPoint() {
final Object raw = new TestBean();
// Will be set by advice during a method call
@@ -133,8 +133,8 @@ public class MethodInvocationProceedingJoinPointTests {
// Any call will do
assertEquals("Advice reentrantly set age", newAge, itb.getAge());
}
@Test
@Test
public void testCanGetSourceLocationFromJoinPoint() {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
@@ -165,8 +165,8 @@ public class MethodInvocationProceedingJoinPointTests {
// Any call will do
itb.getAge();
}
@Test
@Test
public void testCanGetStaticPartFromJoinPoint() {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);

View File

@@ -35,7 +35,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
*/
public final class TypePatternClassFilterTests {
@Test
@Test
public void testInvalidPattern() {
try {
new TypePatternClassFilter("-");
@@ -45,7 +45,7 @@ public final class TypePatternClassFilterTests {
}
}
@Test
@Test
public void testValidPatternMatching() {
TypePatternClassFilter tpcf = new TypePatternClassFilter("org.springframework.beans.*");
assertTrue("Must match: in package", tpcf.matches(TestBean.class));
@@ -56,7 +56,7 @@ public final class TypePatternClassFilterTests {
assertFalse("Must be excluded: in wrong package", tpcf.matches(DefaultListableBeanFactory.class));
}
@Test
@Test
public void testSubclassMatching() {
TypePatternClassFilter tpcf = new TypePatternClassFilter("org.springframework.beans.ITestBean+");
assertTrue("Must match: in package", tpcf.matches(TestBean.class));
@@ -66,7 +66,7 @@ public final class TypePatternClassFilterTests {
assertFalse("Must be excluded: not subclass", tpcf.matches(DefaultListableBeanFactory.class));
}
@Test
@Test
public void testAndOrNotReplacement() {
TypePatternClassFilter tpcf = new TypePatternClassFilter("java.lang.Object or java.lang.String");
assertFalse("matches Number",tpcf.matches(Number.class));
@@ -80,12 +80,12 @@ public final class TypePatternClassFilterTests {
assertTrue("matches Double",tpcf.matches(Double.class));
}
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testSetTypePatternWithNullArgument() throws Exception {
new TypePatternClassFilter(null);
new TypePatternClassFilter(null);
}
@Test(expected=IllegalStateException.class)
@Test(expected=IllegalStateException.class)
public void testInvocationOfMatchesMethodBlowsUpWhenNoTypePatternHasBeenSet() throws Exception {
new TypePatternClassFilter().matches(String.class);
}

View File

@@ -37,7 +37,7 @@ import org.springframework.beans.TestBean;
*/
public class ArgumentBindingTests {
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testBindingInPointcutUsedByAdvice() {
TestBean tb = new TestBean();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb);
@@ -47,7 +47,7 @@ public class ArgumentBindingTests {
proxiedTestBean.setName("Supercalifragalisticexpialidocious"); // should throw
}
@Test(expected=IllegalStateException.class)
@Test(expected=IllegalStateException.class)
public void testAnnotationArgumentNameBinding() {
TransactionalBean tb = new TransactionalBean();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb);
@@ -57,7 +57,7 @@ public class ArgumentBindingTests {
proxiedTestBean.doInTransaction(); // should throw
}
@Test
@Test
public void testParameterNameDiscoverWithReferencePointcut() throws Exception {
AspectJAdviceParameterNameDiscoverer discoverer =
new AspectJAdviceParameterNameDiscoverer("somepc(formal) && set(* *)");

View File

@@ -32,12 +32,12 @@ import example.aspects.PerTargetAspect;
*/
public class AspectMetadataTests {
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testNotAnAspect() {
new AspectMetadata(String.class,"someBean");
}
@Test
@Test
public void testSingletonAspect() {
AspectMetadata am = new AspectMetadata(ExceptionAspect.class,"someBean");
assertFalse(am.isPerThisOrPerTarget());
@@ -45,7 +45,7 @@ public class AspectMetadataTests {
assertEquals(PerClauseKind.SINGLETON, am.getAjType().getPerClause().getKind());
}
@Test
@Test
public void testPerTargetAspect() {
AspectMetadata am = new AspectMetadata(PerTargetAspect.class,"someBean");
assertTrue(am.isPerThisOrPerTarget());
@@ -53,7 +53,7 @@ public class AspectMetadataTests {
assertEquals(PerClauseKind.PERTARGET, am.getAjType().getPerClause().getKind());
}
@Test
@Test
public void testPerThisAspect() {
AspectMetadata am = new AspectMetadata(PerThisAspect.class,"someBean");
assertTrue(am.isPerThisOrPerTarget());

View File

@@ -30,13 +30,13 @@ import example.aspects.PerThisAspect;
*/
public class AspectProxyFactoryTests {
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testWithNonAspect() {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
proxyFactory.addAspect(TestBean.class);
}
@Test
@Test
public void testWithSimpleAspect() throws Exception {
TestBean bean = new TestBean();
bean.setAge(2);
@@ -46,7 +46,7 @@ public class AspectProxyFactoryTests {
assertEquals("Multiplication did not occur", bean.getAge() * 2, proxy.getAge());
}
@Test
@Test
public void testWithPerThisAspect() throws Exception {
TestBean bean1 = new TestBean();
TestBean bean2 = new TestBean();

View File

@@ -29,7 +29,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public class AopNamespaceHandlerPointcutErrorTests {
@Test
@Test
public void testDuplicatePointcutConfig() {
try {
new XmlBeanFactory(new ClassPathResource(
@@ -40,8 +40,8 @@ public class AopNamespaceHandlerPointcutErrorTests {
assertTrue(ex.contains(BeanDefinitionParsingException.class));
}
}
@Test
@Test
public void testMissingPointcutConfig() {
try {
new XmlBeanFactory(new ClassPathResource(

View File

@@ -30,7 +30,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public final class TopLevelAopTagTests {
@Test
@Test
public void testParse() throws Exception {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.framework;
/**
@@ -22,7 +22,7 @@
* @author Rod Johnson
*/
public class DefaultLockable implements Lockable {
private boolean locked;
public void lock() {

View File

@@ -32,54 +32,54 @@ import org.springframework.util.StopWatch;
* @since 2.0
*/
public class IntroductionBenchmarkTests {
private static final int EXPECTED_COMPARE = 13;
/** Increase this if you want meaningful results! */
private static final int INVOCATIONS = 100000;
@SuppressWarnings("serial")
public static class SimpleCounterIntroduction extends DelegatingIntroductionInterceptor implements Counter {
public int getCount() {
return EXPECTED_COMPARE;
}
}
public static interface Counter {
int getCount();
}
@Test
public void timeManyInvocations() {
StopWatch sw = new StopWatch();
TestBean target = new TestBean();
ProxyFactory pf = new ProxyFactory(target);
pf.setProxyTargetClass(false);
pf.addAdvice(new SimpleCounterIntroduction());
ITestBean proxy = (ITestBean) pf.getProxy();
Counter counter = (Counter) proxy;
sw.start(INVOCATIONS + " invocations on proxy, not hitting introduction");
for (int i = 0; i < INVOCATIONS; i++) {
proxy.getAge();
}
sw.stop();
sw.start(INVOCATIONS + " invocations on proxy, hitting introduction");
for (int i = 0; i < INVOCATIONS; i++) {
counter.getCount();
}
sw.stop();
sw.start(INVOCATIONS + " invocations on target");
for (int i = 0; i < INVOCATIONS; i++) {
target.getAge();
}
sw.stop();
System.out.println(sw.prettyPrint());
}
sw.start(INVOCATIONS + " invocations on proxy, not hitting introduction");
for (int i = 0; i < INVOCATIONS; i++) {
proxy.getAge();
}
sw.stop();
sw.start(INVOCATIONS + " invocations on proxy, hitting introduction");
for (int i = 0; i < INVOCATIONS; i++) {
counter.getCount();
}
sw.stop();
sw.start(INVOCATIONS + " invocations on target");
for (int i = 0; i < INVOCATIONS; i++) {
target.getAge();
}
sw.stop();
System.out.println(sw.prettyPrint());
}
}

View File

@@ -41,7 +41,7 @@ import org.springframework.aop.framework.MethodCounter;
*/
public class ThrowsAdviceInterceptorTests {
@Test
@Test
public void testNoHandlerMethods() {
Object o = new Object();
try {
@@ -52,8 +52,8 @@ public class ThrowsAdviceInterceptorTests {
// Ok
}
}
@Test
@Test
public void testNotInvoked() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
@@ -65,8 +65,8 @@ public class ThrowsAdviceInterceptorTests {
assertEquals(0, th.getCalls());
verify(mi);
}
@Test
@Test
public void testNoHandlerMethodForThrowable() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
@@ -85,8 +85,8 @@ public class ThrowsAdviceInterceptorTests {
assertEquals(0, th.getCalls());
verify(mi);
}
@Test
@Test
public void testCorrectHandlerUsed() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
@@ -108,8 +108,8 @@ public class ThrowsAdviceInterceptorTests {
assertEquals(1, th.getCalls("ioException"));
verify(mi);
}
@Test
@Test
public void testCorrectHandlerUsedForSubclass() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
@@ -129,11 +129,11 @@ public class ThrowsAdviceInterceptorTests {
assertEquals(1, th.getCalls("remoteException"));
verify(mi);
}
@Test
@Test
public void testHandlerMethodThrowsException() throws Throwable {
final Throwable t = new Throwable();
@SuppressWarnings("serial")
MyThrowsHandler th = new MyThrowsHandler() {
public void afterThrowing(RemoteException ex) throws Throwable {
@@ -141,7 +141,7 @@ public class ThrowsAdviceInterceptorTests {
throw t;
}
};
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
// Extends RemoteException
TransactionRolledbackException ex = new TransactionRolledbackException();
@@ -159,9 +159,9 @@ public class ThrowsAdviceInterceptorTests {
assertEquals(1, th.getCalls("remoteException"));
verify(mi);
}
@SuppressWarnings("serial")
private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
// Full method signature
public void afterThrowing(Method m, Object[] args, Object target, IOException ex) {
count("ioException");
@@ -169,11 +169,11 @@ public class ThrowsAdviceInterceptorTests {
public void afterThrowing(RemoteException ex) throws Throwable {
count("remoteException");
}
/** Not valid, wrong number of arguments */
public void afterThrowing(Method m, Exception ex) throws Throwable {
throw new UnsupportedOperationException("Shouldn't be called");
}
}
}