Browse Source

moving unit tests from .testsuite -> .aop

conversation
Chris Beams 16 years ago
parent
commit
7bba0b7a69
  1. 11
      org.springframework.aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
  2. 7
      org.springframework.testsuite/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java
  3. 16
      org.springframework.testsuite/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java

11
org.springframework.testsuite/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java → org.springframework.aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java

@ -16,17 +16,20 @@ @@ -16,17 +16,20 @@
package org.springframework.aop.aspectj;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.TestBean;
/**
* Tests for matching of bean() pointcut designator.
*
* @author Ramnivas Laddad
* @author Chris Beams
*/
public class BeanNamePointcutMatchingTests extends TestCase {
public class BeanNamePointcutMatchingTests {
@Test
public void testMatchingPointcuts() {
assertMatch("someName", "bean(someName)");
@ -61,6 +64,7 @@ public class BeanNamePointcutMatchingTests extends TestCase { @@ -61,6 +64,7 @@ public class BeanNamePointcutMatchingTests extends TestCase {
assertMatch("someName", "bean(someName) && !bean(someOtherName)");
}
@Test
public void testNonMatchingPointcuts() {
assertMisMatch("someName", "bean(someNamex)");
assertMisMatch("someName", "bean(someX*Name)");
@ -82,7 +86,8 @@ public class BeanNamePointcutMatchingTests extends TestCase { @@ -82,7 +86,8 @@ public class BeanNamePointcutMatchingTests extends TestCase {
matches(beanName, pcExpression));
}
private static boolean matches(final String beanName, String pcExpression) {
private static boolean matches(final String beanName, String pcExpression) {
@SuppressWarnings("serial")
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() {
protected String getCurrentProxiedBeanName() {
return beanName;

7
org.springframework.testsuite/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java

@ -16,7 +16,9 @@ @@ -16,7 +16,9 @@
package org.springframework.aop.aspectj.autoproxy;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.ITestBean;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -27,8 +29,9 @@ import java.io.IOException; @@ -27,8 +29,9 @@ import java.io.IOException;
* @author Rob Harrop
* @since 2.0
*/
public class AtAspectJAfterThrowingTests extends TestCase {
public class AtAspectJAfterThrowingTests {
@Test
public void testAccessThrowable() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("afterThrowingAdviceTests.xml", getClass());

16
org.springframework.testsuite/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java

@ -16,8 +16,9 @@ @@ -16,8 +16,9 @@
package org.springframework.aop.aspectj.autoproxy.benchmark;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.ITestBean;
@ -25,12 +26,13 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -25,12 +26,13 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.util.StopWatch;
/**
* Tests for AspectJ auto proxying. Includes mixing with Spring AOP
* Integration tests for AspectJ auto proxying. Includes mixing with Spring AOP
* Advisors to demonstrate that existing autoproxying contract is honoured.
*
* @author Rod Johnson
* @author Chris Beams
*/
public class BenchmarkTests extends TestCase {
public class BenchmarkTests {
private static final String ASPECTJ_CONTEXT = "/org/springframework/aop/aspectj/autoproxy/benchmark/aspectj.xml";
@ -43,34 +45,42 @@ public class BenchmarkTests extends TestCase { @@ -43,34 +45,42 @@ public class BenchmarkTests extends TestCase {
return 10;
}
@Test
public void testRepeatedAroundAdviceInvocationsWithAspectJ() {
testRepeatedAroundAdviceInvocations(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedAroundAdviceInvocationsWithSpringAop() {
testRepeatedAroundAdviceInvocations(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}
@Test
public void testRepeatedBeforeAdviceInvocationsWithAspectJ() {
testBeforeAdviceWithoutJoinPoint(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedBeforeAdviceInvocationsWithSpringAop() {
testBeforeAdviceWithoutJoinPoint(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}
@Test
public void testRepeatedAfterReturningAdviceInvocationsWithAspectJ() {
testAfterReturningAdviceWithoutJoinPoint(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedAfterReturningAdviceInvocationsWithSpringAop() {
testAfterReturningAdviceWithoutJoinPoint(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}
@Test
public void testRepeatedMixWithAspectJ() {
testMix(ASPECTJ_CONTEXT, getCount(), "AspectJ");
}
@Test
public void testRepeatedMixWithSpringAop() {
testMix(SPRING_AOP_CONTEXT, getCount(), "Spring AOP");
}

Loading…
Cancel
Save