Merge branch '3.2.x'
* 3.2.x: (28 commits) Hide 'doc' changes from jdiff reports Document @Bean 'lite' mode vs @Configuration Final preparations for 3.2.2 Remove Tiles 3 configuration method Polishing Extracted buildRequestAttributes template method from FrameworkServlet Added "beforeExistingAdvisors" flag to AbstractAdvisingBeanPostProcessor Minor refinements along the way of researching static CGLIB callbacks Compare Kind references before checking log levels Polish Javadoc in RequestAttributes Fix copy-n-paste errors in NativeWebRequest Fix issue with restoring included attributes Add additional test for daylight savings glitch Document context hierarchy support in the TCF Fix test for daylight savings glitch Make the methodParameter field of HandlerMethod final Disable AsyncTests in spring-test-mvc Reformat the testing chapter Document context hierarchy support in the TCF Document context hierarchy support in the TCF ...
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -52,25 +52,13 @@ class ConfigurationClassEnhancer {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ConfigurationClassEnhancer.class);
|
||||
|
||||
private static final Class<?>[] CALLBACK_TYPES = {BeanMethodInterceptor.class,
|
||||
DisposableBeanMethodInterceptor.class, NoOp.class};
|
||||
|
||||
private static final CallbackFilter CALLBACK_FILTER = new CallbackFilter() {
|
||||
public int accept(Method candidateMethod) {
|
||||
// Set up the callback filter to return the index of the BeanMethodInterceptor when
|
||||
// handling a @Bean-annotated method; otherwise, return index of the NoOp callback.
|
||||
if (BeanAnnotationHelper.isBeanAnnotated(candidateMethod)) {
|
||||
return 0;
|
||||
}
|
||||
if (DisposableBeanMethodInterceptor.isDestroyMethod(candidateMethod)) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
private static final CallbackFilter CALLBACK_FILTER = new ConfigurationClassCallbackFilter();
|
||||
|
||||
private static final Callback DISPOSABLE_BEAN_METHOD_INTERCEPTOR = new DisposableBeanMethodInterceptor();
|
||||
|
||||
private static final Class<?>[] CALLBACK_TYPES =
|
||||
{BeanMethodInterceptor.class, DisposableBeanMethodInterceptor.class, NoOp.class};
|
||||
|
||||
private final Callback[] callbackInstances;
|
||||
|
||||
|
||||
@@ -109,21 +97,6 @@ class ConfigurationClassEnhancer {
|
||||
return enhancedClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marker interface to be implemented by all @Configuration CGLIB subclasses.
|
||||
* Facilitates idempotent behavior for {@link ConfigurationClassEnhancer#enhance(Class)}
|
||||
* through checking to see if candidate classes are already assignable to it, e.g.
|
||||
* have already been enhanced.
|
||||
* <p>Also extends {@link DisposableBean}, as all enhanced
|
||||
* {@code @Configuration} classes must de-register static CGLIB callbacks on
|
||||
* destruction, which is handled by the (private) {@code DisposableBeanMethodInterceptor}.
|
||||
* <p>Note that this interface is intended for framework-internal use only, however
|
||||
* must remain public in order to allow access to subclasses generated from other
|
||||
* packages (i.e. user code).
|
||||
*/
|
||||
public interface EnhancedConfiguration extends DisposableBean {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new CGLIB {@link Enhancer} instance.
|
||||
*/
|
||||
@@ -149,6 +122,43 @@ class ConfigurationClassEnhancer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Marker interface to be implemented by all @Configuration CGLIB subclasses.
|
||||
* Facilitates idempotent behavior for {@link ConfigurationClassEnhancer#enhance(Class)}
|
||||
* through checking to see if candidate classes are already assignable to it, e.g.
|
||||
* have already been enhanced.
|
||||
* <p>Also extends {@link DisposableBean}, as all enhanced
|
||||
* {@code @Configuration} classes must de-register static CGLIB callbacks on
|
||||
* destruction, which is handled by the (private) {@code DisposableBeanMethodInterceptor}.
|
||||
* <p>Note that this interface is intended for framework-internal use only, however
|
||||
* must remain public in order to allow access to subclasses generated from other
|
||||
* packages (i.e. user code).
|
||||
*/
|
||||
public interface EnhancedConfiguration extends DisposableBean {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CGLIB CallbackFilter implementation that points to BeanMethodInterceptor and
|
||||
* DisposableBeanMethodInterceptor.
|
||||
*/
|
||||
private static class ConfigurationClassCallbackFilter implements CallbackFilter {
|
||||
|
||||
public int accept(Method candidateMethod) {
|
||||
// Set up the callback filter to return the index of the BeanMethodInterceptor when
|
||||
// handling a @Bean-annotated method; otherwise, return index of the NoOp callback.
|
||||
if (BeanAnnotationHelper.isBeanAnnotated(candidateMethod)) {
|
||||
return 0;
|
||||
}
|
||||
if (DisposableBeanMethodInterceptor.isDestroyMethod(candidateMethod)) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Intercepts calls to {@link FactoryBean#getObject()}, delegating to calling
|
||||
* {@link BeanFactory#getBean(String)} in order to respect caching / scoping.
|
||||
@@ -175,7 +185,7 @@ class ConfigurationClassEnhancer {
|
||||
/**
|
||||
* Intercepts the invocation of any {@link DisposableBean#destroy()} on @Configuration
|
||||
* class instances for the purpose of de-registering CGLIB callbacks. This helps avoid
|
||||
* garbage collection issues See SPR-7901.
|
||||
* garbage collection issues. See SPR-7901.
|
||||
* @see EnhancedConfiguration
|
||||
*/
|
||||
private static class DisposableBeanMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -20,6 +20,7 @@ import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.context.HierarchicalMessageSource;
|
||||
import org.springframework.context.MessageSource;
|
||||
@@ -64,6 +65,8 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
||||
|
||||
private MessageSource parentMessageSource;
|
||||
|
||||
private Properties commonMessages;
|
||||
|
||||
private boolean useCodeAsDefaultMessage = false;
|
||||
|
||||
|
||||
@@ -75,6 +78,23 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
||||
return this.parentMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify locale-independent common messages, with the message code as key
|
||||
* and the full message String (may contain argument placeholders) as value.
|
||||
* <p>May also link to an externally defined Properties object, e.g. defined
|
||||
* through a {@link org.springframework.beans.factory.config.PropertiesFactoryBean}.
|
||||
*/
|
||||
public void setCommonMessages(Properties commonMessages) {
|
||||
this.commonMessages = commonMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Properties object defining locale-independent common messages, if any.
|
||||
*/
|
||||
protected Properties getCommonMessages() {
|
||||
return this.commonMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to use the message code as default message instead of
|
||||
* throwing a NoSuchMessageException. Useful for development and debugging.
|
||||
@@ -210,6 +230,15 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
||||
}
|
||||
}
|
||||
|
||||
// Check locale-independent common messages for the given message code.
|
||||
Properties commonMessages = getCommonMessages();
|
||||
if (commonMessages != null) {
|
||||
String commonMessage = commonMessages.getProperty(code);
|
||||
if (commonMessage != null) {
|
||||
return formatMessage(commonMessage, args, locale);
|
||||
}
|
||||
}
|
||||
|
||||
// Not found -> check parent, if any.
|
||||
return getMessageFromParent(code, argsToUse, locale);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -38,11 +38,15 @@ import org.springframework.util.Assert;
|
||||
* processor will detect both Spring's {@link Async @Async} annotation as well
|
||||
* as the EJB 3.1 {@code javax.ejb.Asynchronous} annotation.
|
||||
*
|
||||
* <p>Note: The underlying async advisor applies before existing advisors by default,
|
||||
* in order to switch to async execution as early as possible in the invocation chain.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.0
|
||||
* @see Async
|
||||
* @see AsyncAnnotationAdvisor
|
||||
* @see #setBeforeExistingAdvisors
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AsyncAnnotationBeanPostProcessor extends AbstractAdvisingBeanPostProcessor
|
||||
@@ -53,6 +57,10 @@ public class AsyncAnnotationBeanPostProcessor extends AbstractAdvisingBeanPostPr
|
||||
private Executor executor;
|
||||
|
||||
|
||||
public AsyncAnnotationBeanPostProcessor() {
|
||||
setBeforeExistingAdvisors(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'async' annotation type to be detected at either class or method
|
||||
* level. By default, both the {@link Async} annotation and the EJB 3.1
|
||||
|
||||
@@ -16,18 +16,17 @@
|
||||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.aspectj.AdviceBindingTestAspect.AdviceBindingCollaborator;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Tests for various parameter binding scenarios with before advice.
|
||||
|
||||
@@ -16,19 +16,17 @@
|
||||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.aspectj.AfterReturningAdviceBindingTestAspect.AfterReturningAdviceBindingCollaborator;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Tests for various parameter binding scenarios with before advice.
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.aspectj.AfterThrowingAdviceBindingTestAspect.AfterThrowingAdviceBindingCollaborator;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Tests for various parameter binding scenarios with before advice.
|
||||
|
||||
@@ -16,20 +16,19 @@
|
||||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.aspectj.AroundAdviceBindingTestAspect.AroundAdviceBindingCollaborator;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.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.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Tests for various parameter binding scenarios with before advice.
|
||||
|
||||
@@ -16,18 +16,17 @@
|
||||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.aspectj.AdviceBindingTestAspect.AdviceBindingCollaborator;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Tests for various parameter binding scenarios with before advice.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,19 +16,15 @@
|
||||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rick Evans
|
||||
* @author Chris Beams
|
||||
|
||||
@@ -16,21 +16,19 @@
|
||||
|
||||
package org.springframework.aop.framework;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
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 static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @since 13.03.2003
|
||||
* @author Rod Johnson
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
package org.springframework.context.access;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Unit test for {@link ContextBeanFactoryReference}
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,11 +16,6 @@
|
||||
|
||||
package org.springframework.context.annotation;
|
||||
|
||||
import static org.mockito.Matchers.isA;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -28,6 +23,9 @@ import org.springframework.context.annotation.EnableLoadTimeWeaving.AspectJWeavi
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.instrument.classloading.LoadTimeWeaver;
|
||||
|
||||
import static org.mockito.Matchers.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Unit tests for @EnableLoadTimeWeaving
|
||||
*
|
||||
|
||||
@@ -20,16 +20,8 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Matchers.isA;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -39,6 +31,10 @@ import org.springframework.context.BeanThatBroadcasts;
|
||||
import org.springframework.context.BeanThatListens;
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* Unit and integration tests for the ApplicationContext event support.
|
||||
|
||||
@@ -16,21 +16,21 @@
|
||||
|
||||
package org.springframework.context.event;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.TestListener;
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Dmitriy Kopylenko
|
||||
|
||||
@@ -249,6 +249,18 @@ public class ResourceBundleMessageSourceTests extends TestCase {
|
||||
assertEquals("nachricht2", ms.getMessage("code2", null, Locale.GERMAN));
|
||||
}
|
||||
|
||||
public void testReloadableResourceBundleMessageSourceWithCommonMessages() {
|
||||
ReloadableResourceBundleMessageSource ms = new ReloadableResourceBundleMessageSource();
|
||||
Properties commonMessages = new Properties();
|
||||
commonMessages.setProperty("warning", "Do not do {0}");
|
||||
ms.setCommonMessages(commonMessages);
|
||||
ms.setBasename("org/springframework/context/support/messages");
|
||||
assertEquals("message1", ms.getMessage("code1", null, Locale.ENGLISH));
|
||||
assertEquals("nachricht2", ms.getMessage("code2", null, Locale.GERMAN));
|
||||
assertEquals("Do not do this", ms.getMessage("warning", new Object[] {"this"}, Locale.ENGLISH));
|
||||
assertEquals("Do not do that", ms.getMessage("warning", new Object[] {"that"}, Locale.GERMAN));
|
||||
}
|
||||
|
||||
public void testReloadableResourceBundleMessageSourceWithWhitespaceInBasename() {
|
||||
ReloadableResourceBundleMessageSource ms = new ReloadableResourceBundleMessageSource();
|
||||
ms.setBasename(" org/springframework/context/support/messages ");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,11 +16,6 @@
|
||||
|
||||
package org.springframework.ejb.access;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import javax.ejb.CreateException;
|
||||
import javax.ejb.EJBLocalHome;
|
||||
import javax.ejb.EJBLocalObject;
|
||||
@@ -31,6 +26,9 @@ import org.junit.Test;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.jndi.JndiTemplate;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,12 +16,6 @@
|
||||
|
||||
package org.springframework.ejb.access;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
import javax.ejb.CreateException;
|
||||
@@ -32,6 +26,9 @@ import javax.naming.NamingException;
|
||||
import org.junit.Test;
|
||||
import org.springframework.jndi.JndiTemplate;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
|
||||
package org.springframework.ejb.access;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.rmi.ConnectException;
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
@@ -36,6 +30,9 @@ import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.jndi.JndiTemplate;
|
||||
import org.springframework.remoting.RemoteAccessException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,12 +16,6 @@
|
||||
|
||||
package org.springframework.ejb.access;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
@@ -34,6 +28,9 @@ import org.junit.Test;
|
||||
import org.springframework.jndi.JndiTemplate;
|
||||
import org.springframework.remoting.RemoteAccessException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
|
||||
package org.springframework.jndi;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
@@ -31,6 +25,9 @@ import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,16 +16,14 @@
|
||||
|
||||
package org.springframework.jndi;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NameNotFoundException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CronTriggerTests {
|
||||
@Parameters
|
||||
public static List<Object[]> getParameters() {
|
||||
List<Object[]> list = new ArrayList<Object[]>();
|
||||
list.add(new Object[] { new Date(), TimeZone.getDefault() });
|
||||
list.add(new Object[] { new Date(), TimeZone.getTimeZone("PST") });
|
||||
list.add(new Object[] { new Date(), TimeZone.getTimeZone("CET") });
|
||||
return list;
|
||||
}
|
||||
@@ -422,8 +422,8 @@ public class CronTriggerTests {
|
||||
|
||||
@Test
|
||||
public void testSpecificHourSecond() throws Exception {
|
||||
CronTrigger trigger = new CronTrigger("55 * 2 * * *", timeZone);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 1);
|
||||
CronTrigger trigger = new CronTrigger("55 * 10 * * *", timeZone);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 9);
|
||||
calendar.set(Calendar.SECOND, 54);
|
||||
Date date = calendar.getTime();
|
||||
TriggerContext context1 = getTriggerContext(date);
|
||||
@@ -694,6 +694,26 @@ public class CronTriggerTests {
|
||||
assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDaylightSavingMissingHour() throws Exception {
|
||||
// This trigger has to be somewhere in between 2am and 3am
|
||||
CronTrigger trigger = new CronTrigger("0 10 2 * * *", timeZone);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 31);
|
||||
calendar.set(Calendar.MONTH, Calendar.MARCH);
|
||||
calendar.set(Calendar.YEAR, 2013);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 1);
|
||||
calendar.set(Calendar.SECOND, 54);
|
||||
Date date = calendar.getTime();
|
||||
TriggerContext context1 = getTriggerContext(date);
|
||||
if (timeZone.equals(TimeZone.getTimeZone("CET"))) {
|
||||
// Clocks go forward an hour so 2am doesn't exist in CET for this date
|
||||
calendar.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
calendar.add(Calendar.HOUR_OF_DAY, 1);
|
||||
calendar.set(Calendar.MINUTE, 10);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
|
||||
}
|
||||
|
||||
private void assertMatchesNextSecond(CronTrigger trigger, Calendar calendar) {
|
||||
Date date = calendar.getTime();
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.scripting.bsh;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -26,7 +23,6 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.aop.target.dynamic.Refreshable;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -38,6 +34,9 @@ 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.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import groovy.lang.DelegatingMetaClass;
|
||||
import groovy.lang.GroovyObject;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import groovy.lang.DelegatingMetaClass;
|
||||
import groovy.lang.GroovyObject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.aop.target.dynamic.Refreshable;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
@@ -52,7 +52,6 @@ import org.springframework.util.ObjectUtils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
package org.springframework.scripting.support;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rick Evans
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.scripting.support;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -27,6 +24,8 @@ import junit.framework.TestCase;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rick Evans
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
|
||||
package org.springframework.scripting.support;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
@@ -34,6 +31,7 @@ import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
/**
|
||||
* @author Rick Evans
|
||||
|
||||
Reference in New Issue
Block a user