Use Gradle test fixture support for spring-beans and spring-context

See gh-23550
This commit is contained in:
Sam Brannen
2019-12-28 17:13:39 +01:00
parent 5718bf424b
commit 61d4ee594d
585 changed files with 2270 additions and 1618 deletions

View File

@@ -22,9 +22,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AdviceBindingTestAspect.AdviceBindingCollaborator;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

View File

@@ -22,9 +22,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AfterReturningAdviceBindingTestAspect.AfterReturningAdviceBindingCollaborator;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

View File

@@ -20,8 +20,8 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AfterThrowingAdviceBindingTestAspect.AfterThrowingAdviceBindingCollaborator;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.mock;

View File

@@ -23,10 +23,10 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AroundAdviceBindingTestAspect.AroundAdviceBindingCollaborator;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

View File

@@ -24,10 +24,10 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.lang.Nullable;
import org.springframework.tests.sample.beans.ITestBean;
/**
* @author Adrian Colyer

View File

@@ -21,8 +21,8 @@ import org.aopalliance.intercept.MethodInvocation;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -22,9 +22,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.annotation.AspectJProxyFactory;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.lang.Nullable;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -22,9 +22,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AdviceBindingTestAspect.AdviceBindingCollaborator;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

View File

@@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test;
import test.mixin.Lockable;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2019 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.aspectj;
import org.aspectj.lang.ProceedingJoinPoint;
@@ -20,8 +21,8 @@ import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.TestBean;
/**
* Tests to check if the first implicit join point argument is correctly processed.
@@ -33,14 +34,15 @@ import org.springframework.tests.sample.beans.TestBean;
public class ImplicitJPArgumentMatchingAtAspectJTests {
@Test
@SuppressWarnings("resource")
public void testAspect() {
// nothing to really test; it is enough if we don't get error while creating app context
// nothing to really test; it is enough if we don't get error while creating the app context
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
}
@Aspect
static class CounterAtAspectJAspect {
@Around(value="execution(* org.springframework.tests.sample.beans.TestBean.*(..)) and this(bean) and args(argument)",
@Around(value="execution(* org.springframework.beans.test.fixtures.beans.TestBean.*(..)) and this(bean) and args(argument)",
argNames="bean,argument")
public void increment(ProceedingJoinPoint pjp, TestBean bean, Object argument) throws Throwable {
pjp.proceed();

View File

@@ -20,8 +20,8 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -18,9 +18,9 @@ package org.springframework.aop.aspectj.autoproxy;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -43,6 +43,10 @@ import org.springframework.beans.factory.config.MethodInvokingFactoryBean;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.INestedTestBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.NestedTestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
@@ -54,10 +58,6 @@ import org.springframework.core.test.fixtures.Assume;
import org.springframework.core.test.fixtures.EnabledForTestGroups;
import org.springframework.core.test.fixtures.TestGroup;
import org.springframework.lang.Nullable;
import org.springframework.tests.sample.beans.INestedTestBean;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.NestedTestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.StopWatch;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -23,8 +23,8 @@ import org.aspectj.lang.annotation.Aspect;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;
@@ -64,7 +64,7 @@ class ExceptionHandlingAspect {
public IOException lastException;
@AfterThrowing(pointcut = "within(org.springframework.tests.sample.beans.ITestBean+)", throwing = "ex")
@AfterThrowing(pointcut = "within(org.springframework.beans.test.fixtures.beans.ITestBean+)", throwing = "ex")
public void handleIOException(IOException ex) {
handled++;
lastException = ex;

View File

@@ -32,8 +32,8 @@ import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.StaticMethodMatcherPointcut;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.util.StopWatch;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -25,9 +25,9 @@ import org.aspectj.lang.annotation.Pointcut;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.Employee;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.Employee;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -23,11 +23,11 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.aop.advice.CountingBeforeAdvice;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -57,6 +57,11 @@ import org.springframework.aop.support.Pointcuts;
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
import org.springframework.aop.target.HotSwappableTargetSource;
import org.springframework.aop.target.SingletonTargetSource;
import org.springframework.beans.test.fixtures.beans.IOther;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.Person;
import org.springframework.beans.test.fixtures.beans.SerializablePerson;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.core.test.fixtures.EnabledForTestGroups;
import org.springframework.core.test.fixtures.TestGroup;
import org.springframework.core.test.fixtures.TimeStamped;
@@ -69,11 +74,6 @@ import org.springframework.tests.aop.advice.MyThrowsHandler;
import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.aop.interceptor.SerializableNopInterceptor;
import org.springframework.tests.aop.interceptor.TimestampIntroductionInterceptor;
import org.springframework.tests.sample.beans.IOther;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.Person;
import org.springframework.tests.sample.beans.SerializablePerson;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.StopWatch;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -28,13 +28,13 @@ import org.springframework.aop.MethodMatcher;
import org.springframework.aop.Pointcut;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.aop.advice.CountingBeforeAdvice;
import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -24,9 +24,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
import org.springframework.aop.support.AopUtils;
import org.springframework.tests.sample.beans.IOther;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.IOther;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

View File

@@ -45,8 +45,12 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.Person;
import org.springframework.beans.test.fixtures.beans.SideEffectBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationListener;
import org.springframework.context.TestListener;
import org.springframework.context.test.fixtures.beans.TestApplicationListener;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.test.fixtures.TimeStamped;
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
@@ -55,10 +59,6 @@ import org.springframework.tests.aop.advice.CountingBeforeAdvice;
import org.springframework.tests.aop.advice.MyThrowsHandler;
import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.aop.interceptor.TimestampIntroductionInterceptor;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.Person;
import org.springframework.tests.sample.beans.SideEffectBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -93,7 +93,7 @@ public class ProxyFactoryBeanTests {
@BeforeEach
public void setUp() throws Exception {
DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
parent.registerBeanDefinition("target2", new RootBeanDefinition(TestListener.class));
parent.registerBeanDefinition("target2", new RootBeanDefinition(TestApplicationListener.class));
this.factory = new DefaultListableBeanFactory(parent);
new XmlBeanDefinitionReader((BeanDefinitionRegistry) this.factory).loadBeanDefinitions(
new ClassPathResource(CONTEXT, getClass()));

View File

@@ -28,8 +28,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.BeforeAdvice;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -31,11 +31,11 @@ import org.springframework.aop.target.LazyInitTargetSource;
import org.springframework.aop.target.PrototypeTargetSource;
import org.springframework.aop.target.ThreadLocalTargetSource;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.test.fixtures.beans.CountingTestBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.aop.advice.CountingBeforeAdvice;
import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.CountingTestBean;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -37,16 +37,16 @@ import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.factory.DummyFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.MessageSource;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.context.support.StaticMessageSource;
import org.springframework.lang.Nullable;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.IndexedTestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.tests.sample.beans.factory.DummyFactory;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -21,9 +21,9 @@ import java.lang.reflect.Method;
import org.junit.jupiter.api.Test;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.lang.Nullable;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

View File

@@ -25,12 +25,12 @@ import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.test.fixtures.TimeStamped;
import org.springframework.tests.aop.advice.CountingBeforeAdvice;
import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -25,12 +25,12 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.test.fixtures.SimpleMapScope;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
import org.springframework.tests.context.SimpleMapScope;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -25,12 +25,12 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.Person;
import org.springframework.beans.test.fixtures.beans.SerializablePerson;
import org.springframework.beans.test.fixtures.beans.SideEffectBean;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
import org.springframework.tests.sample.beans.Person;
import org.springframework.tests.sample.beans.SerializablePerson;
import org.springframework.tests.sample.beans.SideEffectBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -20,9 +20,9 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.interceptor.DebugInterceptor;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -18,9 +18,9 @@ package org.springframework.beans.factory.xml;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -33,10 +33,10 @@ import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.support.MethodReplacer;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.IndexedTestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.tests.sample.beans.factory.DummyFactory;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.factory.DummyFactory;
/**
* Types used by {@link XmlBeanFactoryTests} and its attendant XML config files.

View File

@@ -51,18 +51,18 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.MethodReplacer;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.DependenciesBean;
import org.springframework.beans.test.fixtures.beans.DerivedTestBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.factory.DummyFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.UrlResource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
import org.springframework.tests.sample.beans.DependenciesBean;
import org.springframework.tests.sample.beans.DerivedTestBean;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.IndexedTestBean;
import org.springframework.tests.sample.beans.ResourceTestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.tests.sample.beans.factory.DummyFactory;
import org.springframework.util.ClassUtils;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StopWatch;

View File

@@ -51,13 +51,13 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.beans.factory.xml.PluggableSchemaResolver;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationListener;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -24,6 +24,7 @@ import java.util.Optional;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
@@ -39,7 +40,6 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.Nullable;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;

View File

@@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentMap;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.cache.AbstractValueAdaptingCacheTests;
import org.springframework.context.test.fixtures.cache.AbstractValueAdaptingCacheTests;
import org.springframework.core.serializer.support.SerializationDelegate;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -18,6 +18,7 @@ package org.springframework.cache.config;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.context.test.fixtures.cache.AbstractCacheAnnotationTests;
/**
* @author Costin Leau

View File

@@ -22,6 +22,7 @@ import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.cache.interceptor.CacheInterceptor;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.context.test.fixtures.cache.AbstractCacheAnnotationTests;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.cache.interceptor.CacheInterceptor;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.context.test.fixtures.cache.AbstractCacheAnnotationTests;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -24,7 +24,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.cache.CacheManager;
import org.springframework.cache.CacheTestUtils;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.CacheInterceptor;
import org.springframework.cache.interceptor.CacheOperationInvoker;
@@ -33,6 +32,9 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.test.fixtures.cache.CacheTestUtils;
import org.springframework.context.test.fixtures.cache.beans.CacheableService;
import org.springframework.context.test.fixtures.cache.beans.DefaultCacheableService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -24,7 +24,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.CacheTestUtils;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.CachingConfigurerSupport;
@@ -34,12 +33,13 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.test.fixtures.cache.CacheTestUtils;
import org.springframework.core.env.Environment;
import org.springframework.mock.env.MockEnvironment;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cache.CacheTestUtils.assertCacheHit;
import static org.springframework.cache.CacheTestUtils.assertCacheMiss;
import static org.springframework.context.test.fixtures.cache.CacheTestUtils.assertCacheHit;
import static org.springframework.context.test.fixtures.cache.CacheTestUtils.assertCacheMiss;
/**
* Tests that represent real use cases with advanced configuration.

View File

@@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.cache.CacheManager;
import org.springframework.cache.CacheTestUtils;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.CacheErrorHandler;
@@ -35,6 +34,13 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.test.fixtures.cache.AbstractCacheAnnotationTests;
import org.springframework.context.test.fixtures.cache.CacheTestUtils;
import org.springframework.context.test.fixtures.cache.SomeCustomKeyGenerator;
import org.springframework.context.test.fixtures.cache.SomeKeyGenerator;
import org.springframework.context.test.fixtures.cache.beans.AnnotatedClassCacheableService;
import org.springframework.context.test.fixtures.cache.beans.CacheableService;
import org.springframework.context.test.fixtures.cache.beans.DefaultCacheableService;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -27,7 +27,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.CacheTestUtils;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.CachingConfigurerSupport;
@@ -36,14 +35,15 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.test.fixtures.cache.CacheTestUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.springframework.cache.CacheTestUtils.assertCacheHit;
import static org.springframework.cache.CacheTestUtils.assertCacheMiss;
import static org.springframework.context.test.fixtures.cache.CacheTestUtils.assertCacheHit;
import static org.springframework.context.test.fixtures.cache.CacheTestUtils.assertCacheMiss;
/**
* Provides various {@link CacheResolver} customisations scenario

View File

@@ -23,7 +23,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.cache.CacheManager;
import org.springframework.cache.CacheTestUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
@@ -33,6 +32,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.test.fixtures.cache.CacheTestUtils;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;

View File

@@ -18,7 +18,7 @@ package org.springframework.context;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.tests.sample.beans.LifecycleBean;
import org.springframework.beans.test.fixtures.beans.LifecycleBean;
/**
* Simple bean to test ApplicationContext lifecycle methods for beans

View File

@@ -19,7 +19,7 @@ package org.springframework.context.annotation;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -33,11 +33,11 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.test.fixtures.Assume;
import org.springframework.core.test.fixtures.EnabledForTestGroups;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE;

View File

@@ -31,13 +31,13 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation2.NamedStubDao2;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.core.type.filter.AssignableTypeFilter;
import org.springframework.stereotype.Component;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -23,12 +23,12 @@ import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation4.DependencyBean;
import org.springframework.context.annotation4.FactoryMethodComponent;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.tests.context.SimpleMapScope;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.context.test.fixtures.SimpleMapScope;
import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -42,7 +42,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.index.CandidateComponentsTestClassLoader;
import org.springframework.context.test.fixtures.index.CandidateComponentsTestClassLoader;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.ClassPathResource;

View File

@@ -36,14 +36,14 @@ import org.springframework.beans.factory.config.DestructionAwareBeanPostProcesso
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.INestedTestBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.NestedTestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.test.fixtures.jndi.ExpectedLookupTemplate;
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
import org.springframework.jndi.support.SimpleJndiBeanFactory;
import org.springframework.tests.mock.jndi.ExpectedLookupTemplate;
import org.springframework.tests.sample.beans.INestedTestBean;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.NestedTestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -51,6 +51,7 @@ import org.springframework.context.annotation.ComponentScanParserTests.KustomAnn
import org.springframework.context.annotation.componentscan.simple.ClassWithNestedComponents;
import org.springframework.context.annotation.componentscan.simple.SimpleComponent;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.test.fixtures.SimpleMapScope;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
@@ -59,7 +60,6 @@ import org.springframework.core.test.fixtures.io.SerializationTestUtils;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.tests.context.SimpleMapScope;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition;

View File

@@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.test.fixtures.SimpleMapScope;
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
import org.springframework.tests.context.SimpleMapScope;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -22,7 +22,7 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -21,7 +21,7 @@ import javax.annotation.PostConstruct;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -53,6 +53,8 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProce
import org.springframework.beans.factory.support.ChildBeanDefinition;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.componentscan.simple.SimpleComponent;
import org.springframework.core.ResolvableType;
@@ -61,8 +63,6 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.DescriptiveResource;
import org.springframework.stereotype.Component;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

View File

@@ -23,7 +23,7 @@ import org.springframework.core.convert.converter.Converter;
/**
* @author Juergen Hoeller
*/
public class FooServiceDependentConverter implements Converter<String, org.springframework.tests.sample.beans.TestBean> {
public class FooServiceDependentConverter implements Converter<String, org.springframework.beans.test.fixtures.beans.TestBean> {
@SuppressWarnings("unused")
private FooService fooService;
@@ -33,8 +33,8 @@ public class FooServiceDependentConverter implements Converter<String, org.sprin
}
@Override
public org.springframework.tests.sample.beans.TestBean convert(String source) {
return new org.springframework.tests.sample.beans.TestBean(source);
public org.springframework.beans.test.fixtures.beans.TestBean convert(String source) {
return new org.springframework.beans.test.fixtures.beans.TestBean(source);
}
}

View File

@@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostP
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -23,8 +23,8 @@ package org.springframework.context.annotation;
class MyTestBean {
@Bean
public org.springframework.tests.sample.beans.TestBean myTestBean() {
return new org.springframework.tests.sample.beans.TestBean();
public org.springframework.beans.test.fixtures.beans.TestBean myTestBean() {
return new org.springframework.beans.test.fixtures.beans.TestBean();
}
}

View File

@@ -18,8 +18,8 @@ package org.springframework.context.annotation;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.stereotype.Component;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -30,6 +30,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.core.annotation.AliasFor;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;
@@ -37,7 +38,6 @@ import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.core.io.support.PropertySourceFactory;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -16,10 +16,10 @@
package org.springframework.context.annotation.componentscan.level1;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.tests.sample.beans.TestBean;
@Configuration
@ComponentScan("org.springframework.context.annotation.componentscan.level2")

View File

@@ -16,10 +16,10 @@
package org.springframework.context.annotation.componentscan.level2;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.tests.sample.beans.TestBean;
@Configuration
@ComponentScan("org.springframework.context.annotation.componentscan.level3")

View File

@@ -33,6 +33,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.Colour;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -42,8 +44,6 @@ import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.annotation.AliasFor;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.tests.sample.beans.Colour;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -25,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.NestedTestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -32,8 +34,6 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import org.springframework.tests.sample.beans.NestedTestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -33,7 +34,6 @@ import org.springframework.context.annotation.ConfigurationClassPostProcessor;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
@@ -97,7 +97,7 @@ public class ConfigurationClassAspectIntegrationTests {
return new TestBean("name");
}
@Before("execution(* org.springframework.tests.sample.beans.TestBean.absquatulate(..)) && target(testBean)")
@Before("execution(* org.springframework.beans.test.fixtures.beans.TestBean.absquatulate(..)) && target(testBean)")
public void touchBean(TestBean testBean) {
testBean.setName("advisedName");
}
@@ -122,7 +122,7 @@ public class ConfigurationClassAspectIntegrationTests {
@Aspect
static class NameChangingAspect {
@Before("execution(* org.springframework.tests.sample.beans.TestBean.absquatulate(..)) && target(testBean)")
@Before("execution(* org.springframework.beans.test.fixtures.beans.TestBean.absquatulate(..)) && target(testBean)")
public void touchBean(TestBean testBean) {
testBean.setName("advisedName");
}

View File

@@ -46,6 +46,9 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.NestedTestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.AnnotationConfigUtils;
@@ -56,9 +59,6 @@ import org.springframework.context.annotation.Scope;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.NestedTestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -19,12 +19,12 @@ package org.springframework.context.annotation.configuration;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -21,10 +21,10 @@ import java.lang.annotation.RetentionPolicy;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -23,11 +23,11 @@ import java.lang.annotation.Target;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -26,13 +26,13 @@ import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
@@ -147,7 +147,7 @@ public class ImportResourceTests {
@Aspect
static class AnAspect {
@Before("execution(* org.springframework.tests.sample.beans.TestBean.*(..))")
@Before("execution(* org.springframework.beans.test.fixtures.beans.TestBean.*(..))")
public void advice() { }
}

View File

@@ -20,14 +20,14 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Import;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -19,12 +19,12 @@ package org.springframework.context.annotation.configuration;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -31,14 +31,14 @@ import org.springframework.aop.scope.ScopedObject;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -18,12 +18,12 @@ package org.springframework.context.annotation4;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.BeanAge;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import org.springframework.tests.sample.beans.TestBean;
/**
* Class used to test the functionality of factory method bean definitions

View File

@@ -16,8 +16,8 @@
package org.springframework.context.annotation4;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.Bean;
import org.springframework.tests.sample.beans.TestBean;
/**
* Class to test that @FactoryMethods are detected only when inside a class with an @Component

View File

@@ -16,9 +16,9 @@
package org.springframework.context.annotation6;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.tests.sample.beans.TestBean;
@Configuration
public class ConfigForScanning {

View File

@@ -31,22 +31,22 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.BeanThatBroadcasts;
import org.springframework.context.BeanThatListens;
import org.springframework.context.PayloadApplicationEvent;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.context.support.StaticMessageSource;
import org.springframework.context.test.fixtures.beans.BeanThatBroadcasts;
import org.springframework.context.test.fixtures.beans.BeanThatListens;
import org.springframework.core.Ordered;
import org.springframework.core.ResolvableType;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.support.TaskUtils;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -22,13 +22,13 @@ import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.TestListener;
import org.springframework.context.event.test.TestEvent;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.context.test.fixtures.beans.TestApplicationListener;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@@ -85,7 +85,7 @@ public class EventPublicationInterceptorTests {
@Test
public void testExpectedBehavior() {
TestBean target = new TestBean();
final TestListener listener = new TestListener();
final TestApplicationListener listener = new TestApplicationListener();
class TestContext extends StaticApplicationContext {
@Override
@@ -114,7 +114,7 @@ public class EventPublicationInterceptorTests {
// two events: ContextRefreshedEvent and TestEvent
assertThat(listener.getEventCount() == 2).as("Interceptor must have published 2 events").isTrue();
TestListener otherListener = (TestListener) ctx.getBean("&otherListener");
TestApplicationListener otherListener = (TestApplicationListener) ctx.getBean("&otherListener");
assertThat(otherListener.getEventCount() == 2).as("Interceptor must have published 2 events").isTrue();
}
@@ -128,7 +128,7 @@ public class EventPublicationInterceptorTests {
}
public static class FactoryBeanTestListener extends TestListener implements FactoryBean<Object> {
public static class FactoryBeanTestListener extends TestApplicationListener implements FactoryBean<Object> {
@Override
public Object getObject() {

View File

@@ -43,6 +43,7 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.AnnotationConfigUtils;
import org.springframework.context.support.GenericApplicationContext;
@@ -54,7 +55,6 @@ import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.test.fixtures.Assume;
import org.springframework.core.test.fixtures.EnabledForTestGroups;
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StopWatch;

View File

@@ -19,10 +19,10 @@ package org.springframework.context.expression;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.test.fixtures.env.MockPropertySource;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition;

View File

@@ -21,6 +21,7 @@ import java.util.Set;
import org.junit.jupiter.api.Test;
import org.springframework.context.test.fixtures.index.CandidateComponentsTestClassLoader;
import org.springframework.core.io.ClassPathResource;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -27,13 +27,13 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.Ordered;
import org.springframework.core.PriorityOrdered;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.Assert;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -26,8 +26,8 @@ import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.config.PropertyResourceConfigurer;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.StringUtils;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
@@ -31,7 +32,6 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.test.fixtures.env.MockPropertySource;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -21,8 +21,8 @@ import java.util.concurrent.TimeUnit;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -24,18 +24,18 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
import org.springframework.context.ACATester;
import org.springframework.context.AbstractApplicationContextTests;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.BeanThatListens;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.SimpleApplicationEventMulticaster;
import org.springframework.context.test.fixtures.AbstractApplicationContextTests;
import org.springframework.context.test.fixtures.beans.ACATester;
import org.springframework.context.test.fixtures.beans.BeanThatListens;
import org.springframework.core.ResolvableType;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.lang.Nullable;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -24,12 +24,12 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
import org.springframework.context.ACATester;
import org.springframework.context.AbstractApplicationContextTests;
import org.springframework.context.BeanThatListens;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.test.fixtures.AbstractApplicationContextTests;
import org.springframework.context.test.fixtures.beans.ACATester;
import org.springframework.context.test.fixtures.beans.BeanThatListens;
import org.springframework.core.io.ClassPathResource;
import org.springframework.tests.sample.beans.TestBean;
/**
* Tests for static application context.

View File

@@ -26,12 +26,12 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
import org.springframework.context.ACATester;
import org.springframework.context.AbstractApplicationContextTests;
import org.springframework.context.BeanThatListens;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.MessageSourceResolvable;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.test.fixtures.AbstractApplicationContextTests;
import org.springframework.context.test.fixtures.beans.ACATester;
import org.springframework.context.test.fixtures.beans.BeanThatListens;
import org.springframework.core.io.ClassPathResource;
import static org.assertj.core.api.Assertions.assertThat;
@@ -182,9 +182,9 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
Map<String, String> m = new HashMap<>();
m.put("name", "Roderick");
parent.registerPrototype("rod", org.springframework.tests.sample.beans.TestBean.class, new MutablePropertyValues(m));
parent.registerPrototype("rod", org.springframework.beans.test.fixtures.beans.TestBean.class, new MutablePropertyValues(m));
m.put("name", "Albert");
parent.registerPrototype("father", org.springframework.tests.sample.beans.TestBean.class, new MutablePropertyValues(m));
parent.registerPrototype("father", org.springframework.beans.test.fixtures.beans.TestBean.class, new MutablePropertyValues(m));
parent.refresh();
parent.addApplicationListener(parentListener);

View File

@@ -23,8 +23,8 @@ import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.parsing.ComponentDefinition;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.CollectingReaderEventListener;
import org.springframework.core.io.ClassPathResource;
import org.springframework.tests.beans.CollectingReaderEventListener;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -23,12 +23,12 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean;
import org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean;
import org.springframework.jndi.JndiObjectFactoryBean;
import org.springframework.tests.sample.beans.ITestBean;
import static org.assertj.core.api.Assertions.assertThat;
@@ -126,7 +126,7 @@ public class JeeNamespaceHandlerTests {
assertPropertyValue(beanDefinition, "lookupHomeOnStartup", "true");
assertPropertyValue(beanDefinition, "resourceRef", "true");
assertPropertyValue(beanDefinition, "jndiEnvironment", "foo=bar");
assertPropertyValue(beanDefinition, "homeInterface", "org.springframework.tests.sample.beans.ITestBean");
assertPropertyValue(beanDefinition, "homeInterface", "org.springframework.beans.test.fixtures.beans.ITestBean");
assertPropertyValue(beanDefinition, "refreshHomeOnConnectFailure", "true");
assertPropertyValue(beanDefinition, "cacheSessionBean", "true");
}

View File

@@ -42,6 +42,7 @@ import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jmx.AbstractMBeanServerTests;
@@ -54,7 +55,6 @@ import org.springframework.jmx.export.naming.SelfNaming;
import org.springframework.jmx.support.ObjectNameManager;
import org.springframework.jmx.support.RegistrationPolicy;
import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -22,10 +22,10 @@ import javax.naming.NamingException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.tests.mock.jndi.ExpectedLookupTemplate;
import org.springframework.tests.sample.beans.DerivedTestBean;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.DerivedTestBean;
import org.springframework.beans.test.fixtures.beans.ITestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.test.fixtures.jndi.ExpectedLookupTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -365,7 +365,7 @@ public class JndiObjectFactoryBeanTests {
jof.setProxyInterface(ITestBean.class);
assertThatExceptionOfType(NamingException.class).isThrownBy(
jof::afterPropertiesSet)
.withMessageContaining("org.springframework.tests.sample.beans.DerivedTestBean");
.withMessageContaining("org.springframework.beans.test.fixtures.beans.DerivedTestBean");
}
@Test

View File

@@ -21,7 +21,7 @@ import javax.naming.NamingException;
import org.junit.jupiter.api.Test;
import org.springframework.tests.mock.jndi.SimpleNamingContext;
import org.springframework.context.test.fixtures.jndi.SimpleNamingContext;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,244 +0,0 @@
/*
* Copyright 2002-2019 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jndi;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.logging.Logger;
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import org.springframework.tests.mock.jndi.SimpleNamingContext;
import org.springframework.tests.mock.jndi.SimpleNamingContextBuilder;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Juergen Hoeller
* @author Chris Beams
*/
public class SimpleNamingContextTests {
@Test
public void testNamingContextBuilder() throws NamingException {
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
InitialContextFactory factory = builder.createInitialContextFactory(null);
DataSource ds = new StubDataSource();
builder.bind("java:comp/env/jdbc/myds", ds);
Object obj = new Object();
builder.bind("myobject", obj);
Context context1 = factory.getInitialContext(null);
assertThat(context1.lookup("java:comp/env/jdbc/myds") == ds).as("Correct DataSource registered").isTrue();
assertThat(context1.lookup("myobject") == obj).as("Correct Object registered").isTrue();
Hashtable<String, String> env2 = new Hashtable<>();
env2.put("key1", "value1");
Context context2 = factory.getInitialContext(env2);
assertThat(context2.lookup("java:comp/env/jdbc/myds") == ds).as("Correct DataSource registered").isTrue();
assertThat(context2.lookup("myobject") == obj).as("Correct Object registered").isTrue();
assertThat(context2.getEnvironment() != env2).as("Correct environment").isTrue();
assertThat("value1".equals(context2.getEnvironment().get("key1"))).as("Correct key1").isTrue();
Integer i = new Integer(0);
context1.rebind("myinteger", i);
String s = "";
context2.bind("mystring", s);
Context context3 = (Context) context2.lookup("");
context3.rename("java:comp/env/jdbc/myds", "jdbc/myds");
context3.unbind("myobject");
assertThat(context3.getEnvironment() != context2.getEnvironment()).as("Correct environment").isTrue();
context3.addToEnvironment("key2", "value2");
assertThat("value2".equals(context3.getEnvironment().get("key2"))).as("key2 added").isTrue();
context3.removeFromEnvironment("key1");
assertThat(context3.getEnvironment().get("key1") == null).as("key1 removed").isTrue();
assertThat(context1.lookup("jdbc/myds") == ds).as("Correct DataSource registered").isTrue();
assertThatExceptionOfType(NameNotFoundException.class).isThrownBy(() ->
context1.lookup("myobject"));
assertThat(context1.lookup("myinteger") == i).as("Correct Integer registered").isTrue();
assertThat(context1.lookup("mystring") == s).as("Correct String registered").isTrue();
assertThat(context2.lookup("jdbc/myds") == ds).as("Correct DataSource registered").isTrue();
assertThatExceptionOfType(NameNotFoundException.class).isThrownBy(() ->
context2.lookup("myobject"));
assertThat(context2.lookup("myinteger") == i).as("Correct Integer registered").isTrue();
assertThat(context2.lookup("mystring") == s).as("Correct String registered").isTrue();
assertThat(context3.lookup("jdbc/myds") == ds).as("Correct DataSource registered").isTrue();
assertThatExceptionOfType(NameNotFoundException.class).isThrownBy(() ->
context3.lookup("myobject"));
assertThat(context3.lookup("myinteger") == i).as("Correct Integer registered").isTrue();
assertThat(context3.lookup("mystring") == s).as("Correct String registered").isTrue();
Map<String, Binding> bindingMap = new HashMap<>();
NamingEnumeration<?> bindingEnum = context3.listBindings("");
while (bindingEnum.hasMoreElements()) {
Binding binding = (Binding) bindingEnum.nextElement();
bindingMap.put(binding.getName(), binding);
}
boolean condition = bindingMap.get("jdbc").getObject() instanceof Context;
assertThat(condition).as("Correct jdbc subcontext").isTrue();
assertThat(SimpleNamingContext.class.getName().equals(bindingMap.get("jdbc").getClassName())).as("Correct jdbc subcontext").isTrue();
Context jdbcContext = (Context) context3.lookup("jdbc");
jdbcContext.bind("mydsX", ds);
Map<String, Binding> subBindingMap = new HashMap<>();
NamingEnumeration<?> subBindingEnum = jdbcContext.listBindings("");
while (subBindingEnum.hasMoreElements()) {
Binding binding = (Binding) subBindingEnum.nextElement();
subBindingMap.put(binding.getName(), binding);
}
assertThat(ds.equals(subBindingMap.get("myds").getObject())).as("Correct DataSource registered").isTrue();
assertThat(StubDataSource.class.getName().equals(subBindingMap.get("myds").getClassName())).as("Correct DataSource registered").isTrue();
assertThat(ds.equals(subBindingMap.get("mydsX").getObject())).as("Correct DataSource registered").isTrue();
assertThat(StubDataSource.class.getName().equals(subBindingMap.get("mydsX").getClassName())).as("Correct DataSource registered").isTrue();
assertThat(i.equals(bindingMap.get("myinteger").getObject())).as("Correct Integer registered").isTrue();
assertThat(Integer.class.getName().equals(bindingMap.get("myinteger").getClassName())).as("Correct Integer registered").isTrue();
assertThat(s.equals(bindingMap.get("mystring").getObject())).as("Correct String registered").isTrue();
assertThat(String.class.getName().equals(bindingMap.get("mystring").getClassName())).as("Correct String registered").isTrue();
context1.createSubcontext("jdbc").bind("sub/subds", ds);
Map<String, String> pairMap = new HashMap<>();
NamingEnumeration<?> pairEnum = context2.list("jdbc");
while (pairEnum.hasMore()) {
NameClassPair pair = (NameClassPair) pairEnum.next();
pairMap.put(pair.getName(), pair.getClassName());
}
assertThat(SimpleNamingContext.class.getName().equals(pairMap.get("sub"))).as("Correct sub subcontext").isTrue();
Context subContext = (Context) context2.lookup("jdbc/sub");
Map<String, String> subPairMap = new HashMap<>();
NamingEnumeration<?> subPairEnum = subContext.list("");
while (subPairEnum.hasMoreElements()) {
NameClassPair pair = (NameClassPair) subPairEnum.next();
subPairMap.put(pair.getName(), pair.getClassName());
}
assertThat(StubDataSource.class.getName().equals(subPairMap.get("subds"))).as("Correct DataSource registered").isTrue();
assertThat(StubDataSource.class.getName().equals(pairMap.get("myds"))).as("Correct DataSource registered").isTrue();
assertThat(StubDataSource.class.getName().equals(pairMap.get("mydsX"))).as("Correct DataSource registered").isTrue();
pairMap.clear();
pairEnum = context1.list("jdbc/");
while (pairEnum.hasMore()) {
NameClassPair pair = (NameClassPair) pairEnum.next();
pairMap.put(pair.getName(), pair.getClassName());
}
assertThat(StubDataSource.class.getName().equals(pairMap.get("myds"))).as("Correct DataSource registered").isTrue();
assertThat(StubDataSource.class.getName().equals(pairMap.get("mydsX"))).as("Correct DataSource registered").isTrue();
}
/**
* Demonstrates how emptyActivatedContextBuilder() method can be
* used repeatedly, and how it affects creating a new InitialContext()
*/
@Test
public void testCreateInitialContext() throws Exception {
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
String name = "foo";
Object o = new Object();
builder.bind(name, o);
// Check it affects JNDI
Context ctx = new InitialContext();
assertThat(ctx.lookup(name) == o).isTrue();
// Check it returns mutable contexts
ctx.unbind(name);
InitialContext badCtx1 = new InitialContext();
assertThatExceptionOfType(NamingException.class).isThrownBy(() ->
badCtx1.lookup(name));
// Check the same call will work again, but the context is empty
builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
InitialContext badCtx2 = new InitialContext();
assertThatExceptionOfType(NamingException.class).isThrownBy(() ->
badCtx2.lookup(name));
Object o2 = new Object();
builder.bind(name, o2);
assertThat(o2).isEqualTo(badCtx2.lookup(name));
}
static class StubDataSource implements DataSource {
@Override
public Connection getConnection() throws SQLException {
return null;
}
@Override
public Connection getConnection(String username, String password) throws SQLException {
return null;
}
@Override
public PrintWriter getLogWriter() throws SQLException {
return null;
}
@Override
public int getLoginTimeout() throws SQLException {
return 0;
}
@Override
public void setLogWriter(PrintWriter arg0) throws SQLException {
}
@Override
public void setLoginTimeout(int arg0) throws SQLException {
}
@Override
public boolean isWrapperFor(Class<?> arg0) throws SQLException {
return false;
}
@Override
public <T> T unwrap(Class<T> arg0) throws SQLException {
return null;
}
@Override
public Logger getParentLogger() {
return null;
}
}
}

View File

@@ -16,8 +16,8 @@
package org.springframework.scripting;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.tests.sample.beans.TestBean;
/**
* @author Juergen Hoeller

View File

@@ -16,7 +16,7 @@
package org.springframework.scripting;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.beans.test.fixtures.beans.TestBean;
/**
* @author Juergen Hoeller

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.target.dynamic.Refreshable;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -35,7 +36,6 @@ import org.springframework.scripting.ScriptCompilationException;
import org.springframework.scripting.ScriptSource;
import org.springframework.scripting.TestBeanAwareMessenger;
import org.springframework.scripting.support.ScriptFactoryPostProcessor;
import org.springframework.tests.sample.beans.TestBean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -29,6 +29,7 @@ import org.springframework.aop.target.dynamic.Refreshable;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.test.fixtures.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.NestedRuntimeException;
@@ -42,7 +43,6 @@ import org.springframework.scripting.ScriptCompilationException;
import org.springframework.scripting.ScriptSource;
import org.springframework.scripting.support.ScriptFactoryPostProcessor;
import org.springframework.stereotype.Component;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.ObjectUtils;
import static org.assertj.core.api.Assertions.assertThat;

Some files were not shown because too many files have changed in this diff Show More