diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/annotation/BatchComponentIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/annotation/BatchComponentIntegrationTests.java index c73a4cf90..17ce5d3f6 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/annotation/BatchComponentIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/annotation/BatchComponentIntegrationTests.java @@ -11,6 +11,8 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import sun.reflect.generics.scope.Scope; + /** * @author Lucas Ward * @@ -55,7 +57,7 @@ public class BatchComponentIntegrationTests { ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory)context.getAutowireCapableBeanFactory(); BeanDefinition beanDef = beanFactory.getBeanDefinition(beanNames[0]); //Even though BatchComponent is annotated with StepScope, the scope will still be singleton without the resolver. - assertEquals("step", beanDef.getScope()); + assertEquals(BeanDefinition.SCOPE_SINGLETON, beanDef.getScope()); } @Test @@ -68,35 +70,6 @@ public class BatchComponentIntegrationTests { ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory)context.getAutowireCapableBeanFactory(); BeanDefinition beanDef = beanFactory.getBeanDefinition(beanNames[0]); //Even though BatchComponent is annotated with StepScope, the scope will still be singleton without the resolver. - assertEquals("step", beanDef.getScope()); - } - - @Test - public void testWithPostProcessor(){ - - ApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/batch/core/annotation/batch-component-context-postprocessor.xml"); - String[] beanNames = context.getBeanNamesForType(TestComponent.class); - //There should be one instance of TextComponent in the Spring Container, because it's annotated with BatchComponent, and the filter - //is setup. However, the beanDefinition, should not have the scope on it, because there is no proxy set. - assertEquals(1, beanNames.length); - ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory)context.getAutowireCapableBeanFactory(); - BeanDefinition beanDef = beanFactory.getBeanDefinition(beanNames[0]); - //Even though BatchComponent is annotated with StepScope, the scope will still be singleton without the resolver. - assertEquals("step", beanDef.getScope()); - } - - - @Test - public void testWithPostProcessorScanned(){ - - ApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/batch/core/annotation/batch-component-context-postprocessor-scanned.xml"); - String[] beanNames = context.getBeanNamesForType(TestComponent.class); - //There should be one instance of TextComponent in the Spring Container, because it's annotated with BatchComponent, and the filter - //is setup. However, the beanDefinition, should not have the scope on it, because there is no proxy set. - assertEquals(1, beanNames.length); - ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory)context.getAutowireCapableBeanFactory(); - BeanDefinition beanDef = beanFactory.getBeanDefinition(beanNames[0]); - //Even though BatchComponent is annotated with StepScope, the scope will still be singleton without the resolver. - assertEquals("step", beanDef.getScope()); + assertEquals(BeanDefinition.SCOPE_SINGLETON, beanDef.getScope()); } }