Polishing and fixed broken support for @IfProfileValue in AbstractJpaTests (even though it's deprecated).

This commit is contained in:
Sam Brannen 2011-03-28 17:23:48 +00:00
parent d6be4c5a2a
commit 726564c84d
6 changed files with 47 additions and 5 deletions

View File

@ -70,7 +70,7 @@ public abstract class ConditionalTestCase extends TestCase {
// getName will return the name of the method being run
if (isDisabledInThisEnvironment(getName())) {
recordDisabled();
this.logger.info("**** " + getClass().getName() + "." + getName() + " disabled in this environment: "
this.logger.info("**** " + getClass().getName() + "." + getName() + " is disabled in this environment: "
+ "Total disabled tests = " + getDisabledTestCount());
return;
}

View File

@ -67,6 +67,8 @@ import org.springframework.util.Assert;
* @author Sam Brannen
* @author Juergen Hoeller
* @since 2.0
* @deprecated as of Spring 3.0, in favor of using the listener-based test context framework
* ({@link org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests})
*/
public abstract class AbstractAnnotationAwareTransactionalTests extends
AbstractTransactionalDataSourceSpringContextTests {
@ -151,7 +153,7 @@ public abstract class AbstractAnnotationAwareTransactionalTests extends
if (isDisabledInThisEnvironment(testMethod)) {
recordDisabled();
this.logger.info("**** " + getClass().getName() + "." + getName() + " disabled in this environment: "
this.logger.info("**** " + getClass().getName() + "." + getName() + " is disabled in this environment: "
+ "Total disabled tests=" + getDisabledTestCount());
return;
}

View File

@ -77,6 +77,8 @@ import org.springframework.util.StringUtils;
* @author Rob Harrop
* @author Juergen Hoeller
* @since 2.0
* @deprecated as of Spring 3.0, in favor of using the listener-based test context framework
* ({@link org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests})
*/
public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactionalTests {
@ -157,13 +159,31 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void runBare() throws Throwable {
if (!shouldUseShadowLoader()) {
// getName will return the name of the method being run.
if (isDisabledInThisEnvironment(getName())) {
// Let superclass log that we didn't run the test.
super.runBare();
return;
}
final Method testMethod = getTestMethod();
if (isDisabledInThisEnvironment(testMethod)) {
recordDisabled();
this.logger.info("**** " + getClass().getName() + "." + getName() + " is disabled in this environment: "
+ "Total disabled tests=" + getDisabledTestCount());
return;
}
if (!shouldUseShadowLoader()) {
super.runBare();
return;
}
String combinationOfContextLocationsForThisTestClass = cacheKeys();
ClassLoader classLoaderForThisTestClass = getClass().getClassLoader();
// save the TCCL
@ -305,6 +325,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
private final LoadTimeWeaver ltw;
@SuppressWarnings("unused")
public LoadTimeWeaverInjectingBeanPostProcessor(LoadTimeWeaver ltw) {
this.ltw = ltw;
}
@ -325,6 +346,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
private final ClassLoader shadowingClassLoader;
@SuppressWarnings("unused")
public ShadowingLoadTimeWeaver(ClassLoader shadowingClassLoader) {
this.shadowingClassLoader = shadowingClassLoader;
}

View File

@ -70,7 +70,7 @@ public abstract class ConditionalTestCase extends TestCase {
// getName will return the name of the method being run
if (isDisabledInThisEnvironment(getName())) {
recordDisabled();
this.logger.info("**** " + getClass().getName() + "." + getName() + " disabled in this environment: "
this.logger.info("**** " + getClass().getName() + "." + getName() + " is disabled in this environment: "
+ "Total disabled tests = " + getDisabledTestCount());
return;
}

View File

@ -143,6 +143,7 @@ public abstract class AbstractAnnotationAwareTransactionalTests extends
*/
@Override
public void runBare() throws Throwable {
// getName will return the name of the method being run.
if (isDisabledInThisEnvironment(getName())) {
// Let superclass log that we didn't run the test.
@ -154,7 +155,7 @@ public abstract class AbstractAnnotationAwareTransactionalTests extends
if (isDisabledInThisEnvironment(testMethod)) {
recordDisabled();
this.logger.info("**** " + getClass().getName() + "." + getName() + " disabled in this environment: "
this.logger.info("**** " + getClass().getName() + "." + getName() + " is disabled in this environment: "
+ "Total disabled tests=" + getDisabledTestCount());
return;
}

View File

@ -163,6 +163,23 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void runBare() throws Throwable {
// getName will return the name of the method being run.
if (isDisabledInThisEnvironment(getName())) {
// Let superclass log that we didn't run the test.
super.runBare();
return;
}
final Method testMethod = getTestMethod();
if (isDisabledInThisEnvironment(testMethod)) {
recordDisabled();
this.logger.info("**** " + getClass().getName() + "." + getName() + " is disabled in this environment: "
+ "Total disabled tests=" + getDisabledTestCount());
return;
}
if (!shouldUseShadowLoader()) {
super.runBare();
return;