Browse Source

moving unit tests from .testsuite -> .aop

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@397 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Chris Beams 17 years ago
parent
commit
1867815ac5
  1. 40
      org.springframework.aop/src/test/java/org/springframework/aop/interceptor/SideEffectBean.java
  2. 15
      org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java
  3. 20
      org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java
  4. 9
      org.springframework.aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java
  5. 15
      org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java
  6. 7
      org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java
  7. 11
      org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java
  8. 17
      org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java
  9. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/commonsPoolProxyTests.xml
  10. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/commonsPoolTests.xml
  11. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/customLazyInitTarget.xml
  12. 11
      org.springframework.aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java
  13. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/hotSwapTests.xml
  14. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitFactoryBean.xml
  15. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitSingletonTests.xml
  16. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/prototypeTests.xml
  17. 0
      org.springframework.aop/src/test/java/org/springframework/aop/target/threadLocalTests.xml
  18. 24
      org.springframework.testsuite/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java

40
org.springframework.aop/src/test/java/org/springframework/aop/interceptor/SideEffectBean.java

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
/*
* Copyright 2002-2005 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
*
* http://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.aop.interceptor;
/**
* Bean that changes state on a business invocation, so that
* we can check whether it's been invoked
* @author Rod Johnson
*/
public class SideEffectBean {
private int count;
public void setCount(int count) {
this.count = count;
}
public int getCount() {
return this.count;
}
public void doWork() {
++count;
}
}

15
org.springframework.testsuite/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java

@ -16,20 +16,23 @@ @@ -16,20 +16,23 @@
package org.springframework.aop.target;
import junit.framework.TestCase;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.ITestBean;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import org.springframework.aop.support.AopUtils;
/**
* @author Rob Harrop
* @author Chris Beams
* @since 2.0
*/
public class CommonsPoolTargetSourceProxyTests extends TestCase {
public class CommonsPoolTargetSourceProxyTests {
@Test
public void testProxy() throws Exception {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);

20
org.springframework.testsuite/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java

@ -16,8 +16,11 @@ @@ -16,8 +16,11 @@
package org.springframework.aop.target;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.interceptor.SerializableNopInterceptor;
@ -31,22 +34,25 @@ import org.springframework.util.SerializationTestUtils; @@ -31,22 +34,25 @@ import org.springframework.util.SerializationTestUtils;
/**
* @author Rod Johnson
* @author Chris Beams
*/
public class HotSwappableTargetSourceTests extends TestCase {
public class HotSwappableTargetSourceTests {
/** Initial count value set in bean factory XML */
private static final int INITIAL_COUNT = 10;
private XmlBeanFactory beanFactory;
protected void setUp() throws Exception {
@Before
public void setUp() throws Exception {
this.beanFactory = new XmlBeanFactory(new ClassPathResource("hotSwapTests.xml", getClass()));
}
/**
* We must simulate container shutdown, which should clear threads.
*/
protected void tearDown() {
@After
public void tearDown() {
// Will call pool.close()
this.beanFactory.destroySingletons();
}
@ -55,8 +61,8 @@ public class HotSwappableTargetSourceTests extends TestCase { @@ -55,8 +61,8 @@ public class HotSwappableTargetSourceTests extends TestCase {
* Check it works like a normal invoker
*
*/
@Test
public void testBasicFunctionality() {
SideEffectBean target1 = (SideEffectBean) beanFactory.getBean("target1");
SideEffectBean proxied = (SideEffectBean) beanFactory.getBean("swappable");
assertEquals(INITIAL_COUNT, proxied.getCount() );
proxied.doWork();
@ -67,12 +73,12 @@ public class HotSwappableTargetSourceTests extends TestCase { @@ -67,12 +73,12 @@ public class HotSwappableTargetSourceTests extends TestCase {
assertEquals(INITIAL_COUNT + 2, proxied.getCount() );
}
@Test
public void testValidSwaps() {
SideEffectBean target1 = (SideEffectBean) beanFactory.getBean("target1");
SideEffectBean target2 = (SideEffectBean) beanFactory.getBean("target2");
SideEffectBean proxied = (SideEffectBean) beanFactory.getBean("swappable");
// assertEquals(target1, ((Advised) proxied).getTarget());
assertEquals(target1.getCount(), proxied.getCount() );
proxied.doWork();
assertEquals(INITIAL_COUNT + 1, proxied.getCount() );
@ -117,6 +123,7 @@ public class HotSwappableTargetSourceTests extends TestCase { @@ -117,6 +123,7 @@ public class HotSwappableTargetSourceTests extends TestCase {
return aopex;
}
@Test
public void testRejectsSwapToNull() {
IllegalArgumentException ex = testRejectsSwapToInvalidValue(null);
assertTrue(ex.getMessage().indexOf("null") != -1);
@ -126,6 +133,7 @@ public class HotSwappableTargetSourceTests extends TestCase { @@ -126,6 +133,7 @@ public class HotSwappableTargetSourceTests extends TestCase {
// how to decide what's valid?
@Test
public void testSerialization() throws Exception {
SerializablePerson sp1 = new SerializablePerson();
sp1.setName("Tony");

9
org.springframework.testsuite/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java

@ -16,23 +16,26 @@ @@ -16,23 +16,26 @@
package org.springframework.aop.target;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.ProxyFactory;
/**
* @author Rob Harrop
* @author Juergen Hoeller
* @author Chris Beams
*/
public class LazyCreationTargetSourceTests extends TestCase {
public class LazyCreationTargetSourceTests {
@Test
public void testCreateLazy() {
TargetSource targetSource = new AbstractLazyCreationTargetSource() {
protected Object createObject() {
return new InitCountingBean();
}
public Class getTargetClass() {
public Class<?> getTargetClass() {
return InitCountingBean.class;
}
};

15
org.springframework.testsuite/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java

@ -16,10 +16,11 @@ @@ -16,10 +16,11 @@
package org.springframework.aop.target;
import java.util.Set;
import static org.junit.Assert.*;
import junit.framework.TestCase;
import java.util.Set;
import org.junit.Test;
import org.springframework.beans.ITestBean;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
@ -27,10 +28,12 @@ import org.springframework.core.io.ClassPathResource; @@ -27,10 +28,12 @@ import org.springframework.core.io.ClassPathResource;
/**
* @author Juergen Hoeller
* @author Rob Harrop
* @author Chris Beams
* @since 07.01.2005
*/
public class LazyInitTargetSourceTests extends TestCase {
public class LazyInitTargetSourceTests {
@Test
public void testLazyInitSingletonTargetSource() {
XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("lazyInitSingletonTests.xml", getClass()));
bf.preInstantiateSingletons();
@ -41,6 +44,7 @@ public class LazyInitTargetSourceTests extends TestCase { @@ -41,6 +44,7 @@ public class LazyInitTargetSourceTests extends TestCase {
assertTrue(bf.containsSingleton("target"));
}
@Test
public void testCustomLazyInitSingletonTargetSource() {
XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("customLazyInitTarget.xml", getClass()));
bf.preInstantiateSingletons();
@ -51,16 +55,17 @@ public class LazyInitTargetSourceTests extends TestCase { @@ -51,16 +55,17 @@ public class LazyInitTargetSourceTests extends TestCase {
assertTrue(bf.containsSingleton("target"));
}
@Test
public void testLazyInitFactoryBeanTargetSource() {
XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("lazyInitFactoryBean.xml", getClass()));
bf.preInstantiateSingletons();
Set set1 = (Set) bf.getBean("proxy1");
Set<?> set1 = (Set<?>) bf.getBean("proxy1");
assertFalse(bf.containsSingleton("target1"));
assertTrue(set1.contains("10"));
assertTrue(bf.containsSingleton("target1"));
Set set2 = (Set) bf.getBean("proxy2");
Set<?> set2 = (Set<?>) bf.getBean("proxy2");
assertFalse(bf.containsSingleton("target2"));
assertTrue(set2.contains("20"));
assertTrue(bf.containsSingleton("target2"));

7
org.springframework.testsuite/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java

@ -16,8 +16,9 @@ @@ -16,8 +16,9 @@
package org.springframework.aop.target;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.aop.TargetSource;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.SerializablePerson;
@ -31,9 +32,11 @@ import org.springframework.util.SerializationTestUtils; @@ -31,9 +32,11 @@ import org.springframework.util.SerializationTestUtils;
* and not subclasses.
*
* @author Rod Johnson
* @author Chris Beams
*/
public class PrototypeBasedTargetSourceTests extends TestCase {
public class PrototypeBasedTargetSourceTests {
@Test
public void testSerializability() throws Exception {
MutablePropertyValues tsPvs = new MutablePropertyValues();
tsPvs.addPropertyValue("targetBeanName", "person");

11
org.springframework.testsuite/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java

@ -16,8 +16,10 @@ @@ -16,8 +16,10 @@
package org.springframework.aop.target;
import junit.framework.TestCase;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.springframework.aop.interceptor.SideEffectBean;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
@ -25,15 +27,17 @@ import org.springframework.core.io.ClassPathResource; @@ -25,15 +27,17 @@ import org.springframework.core.io.ClassPathResource;
/**
* @author Rod Johnson
* @author Chris Beams
*/
public class PrototypeTargetSourceTests extends TestCase {
public class PrototypeTargetSourceTests {
/** Initial count value set in bean factory XML */
private static final int INITIAL_COUNT = 10;
private BeanFactory beanFactory;
protected void setUp() throws Exception {
@Before
public void setUp() throws Exception {
this.beanFactory = new XmlBeanFactory(new ClassPathResource("prototypeTests.xml", getClass()));
}
@ -42,6 +46,7 @@ public class PrototypeTargetSourceTests extends TestCase { @@ -42,6 +46,7 @@ public class PrototypeTargetSourceTests extends TestCase {
* in no change to visible state, as a new instance is used.
* With the singleton, there will be change.
*/
@Test
public void testPrototypeAndSingletonBehaveDifferently() {
SideEffectBean singleton = (SideEffectBean) beanFactory.getBean("singleton");
assertEquals(INITIAL_COUNT, singleton.getCount() );

17
org.springframework.testsuite/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java

@ -16,8 +16,10 @@ @@ -16,8 +16,10 @@
package org.springframework.aop.target;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.aop.interceptor.SideEffectBean;
import org.springframework.beans.ITestBean;
import org.springframework.beans.factory.xml.XmlBeanFactory;
@ -25,15 +27,17 @@ import org.springframework.core.io.ClassPathResource; @@ -25,15 +27,17 @@ import org.springframework.core.io.ClassPathResource;
/**
* @author Rod Johnson
* @author Chris Beams
*/
public class ThreadLocalTargetSourceTests extends TestCase {
public class ThreadLocalTargetSourceTests {
/** Initial count value set in bean factory XML */
private static final int INITIAL_COUNT = 10;
private XmlBeanFactory beanFactory;
protected void setUp() throws Exception {
@Before
public void setUp() throws Exception {
this.beanFactory = new XmlBeanFactory(new ClassPathResource("threadLocalTests.xml", getClass()));
}
@ -49,6 +53,7 @@ public class ThreadLocalTargetSourceTests extends TestCase { @@ -49,6 +53,7 @@ public class ThreadLocalTargetSourceTests extends TestCase {
* managing objects of different types without them interfering
* with one another.
*/
@Test
public void testUseDifferentManagedInstancesInSameThread() {
SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment");
assertEquals(INITIAL_COUNT, apartment.getCount() );
@ -60,6 +65,7 @@ public class ThreadLocalTargetSourceTests extends TestCase { @@ -60,6 +65,7 @@ public class ThreadLocalTargetSourceTests extends TestCase {
assertEquals("Kerry", test.getSpouse().getName());
}
@Test
public void testReuseInSameThread() {
SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment");
assertEquals(INITIAL_COUNT, apartment.getCount() );
@ -73,6 +79,7 @@ public class ThreadLocalTargetSourceTests extends TestCase { @@ -73,6 +79,7 @@ public class ThreadLocalTargetSourceTests extends TestCase {
/**
* Relies on introduction.
*/
@Test
public void testCanGetStatsViaMixin() {
ThreadLocalTargetSourceStats stats = (ThreadLocalTargetSourceStats) beanFactory.getBean("apartment");
// +1 because creating target for stats call counts
@ -90,6 +97,7 @@ public class ThreadLocalTargetSourceTests extends TestCase { @@ -90,6 +97,7 @@ public class ThreadLocalTargetSourceTests extends TestCase {
assertEquals(1, stats.getObjectCount());
}
@Test
public void testNewThreadHasOwnInstance() throws InterruptedException {
SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment");
assertEquals(INITIAL_COUNT, apartment.getCount() );
@ -128,11 +136,12 @@ public class ThreadLocalTargetSourceTests extends TestCase { @@ -128,11 +136,12 @@ public class ThreadLocalTargetSourceTests extends TestCase {
/**
* Test for SPR-1442. Destroyed target should re-associated with thread and not throw NPE
*/
@Test
public void testReuseDestroyedTarget() {
ThreadLocalTargetSource source = (ThreadLocalTargetSource)this.beanFactory.getBean("threadLocalTs");
// try first time
Object o = source.getTarget();
source.getTarget();
source.destroy();
// try second time

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/commonsPoolProxyTests.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/commonsPoolProxyTests.xml

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/commonsPoolTests.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/commonsPoolTests.xml

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/customLazyInitTarget.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/customLazyInitTarget.xml

11
org.springframework.testsuite/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java → org.springframework.aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java

@ -16,16 +16,20 @@ @@ -16,16 +16,20 @@
package org.springframework.aop.target.dynamic;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* @author Rob Harrop
* @author Chris Beams
*/
public class RefreshableTargetSourceTests extends TestCase {
public class RefreshableTargetSourceTests {
/**
* Test what happens when checking for refresh but not refreshing object.
*/
@Test
public void testRefreshCheckWithNonRefresh() throws Exception {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource();
ts.setRefreshCheckDelay(0);
@ -41,6 +45,7 @@ public class RefreshableTargetSourceTests extends TestCase { @@ -41,6 +45,7 @@ public class RefreshableTargetSourceTests extends TestCase {
/**
* Test what happens when checking for refresh and refresh occurs.
*/
@Test
public void testRefreshCheckWithRefresh() throws Exception {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource(true);
ts.setRefreshCheckDelay(0);
@ -56,6 +61,7 @@ public class RefreshableTargetSourceTests extends TestCase { @@ -56,6 +61,7 @@ public class RefreshableTargetSourceTests extends TestCase {
/**
* Test what happens when no refresh occurs.
*/
@Test
public void testWithNoRefreshCheck() throws Exception {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource(true);
ts.setRefreshCheckDelay(-1);
@ -67,6 +73,7 @@ public class RefreshableTargetSourceTests extends TestCase { @@ -67,6 +73,7 @@ public class RefreshableTargetSourceTests extends TestCase {
assertSame("Objects should be the same - refresh check delay not elapsed", a, b);
}
@Test
public void testRefreshOverTime() throws Exception {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource(true);
ts.setRefreshCheckDelay(100);

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/hotSwapTests.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/hotSwapTests.xml

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/lazyInitFactoryBean.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitFactoryBean.xml

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/lazyInitSingletonTests.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitSingletonTests.xml

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/prototypeTests.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/prototypeTests.xml

0
org.springframework.testsuite/src/test/java/org/springframework/aop/target/threadLocalTests.xml → org.springframework.aop/src/test/java/org/springframework/aop/target/threadLocalTests.xml

24
org.springframework.testsuite/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java

@ -16,11 +16,14 @@ @@ -16,11 +16,14 @@
package org.springframework.aop.target;
import static org.junit.Assert.*;
import java.util.NoSuchElementException;
import junit.framework.TestCase;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.interceptor.SideEffectBean;
import org.springframework.beans.Person;
@ -37,8 +40,9 @@ import org.springframework.util.SerializationTestUtils; @@ -37,8 +40,9 @@ import org.springframework.util.SerializationTestUtils;
*
* @author Rod Johnson
* @author Rob Harrop
* @author Chris Beams
*/
public class CommonsPoolTargetSourceTests extends TestCase {
public class CommonsPoolTargetSourceTests {
/**
* Initial count value set in bean factory XML
@ -47,14 +51,16 @@ public class CommonsPoolTargetSourceTests extends TestCase { @@ -47,14 +51,16 @@ public class CommonsPoolTargetSourceTests extends TestCase {
private XmlBeanFactory beanFactory;
protected void setUp() throws Exception {
@Before
public void setUp() throws Exception {
this.beanFactory = new XmlBeanFactory(new ClassPathResource("commonsPoolTests.xml", getClass()));
}
/**
* We must simulate container shutdown, which should clear threads.
*/
protected void tearDown() {
@After
public void tearDown() {
// Will call pool.close()
this.beanFactory.destroySingletons();
}
@ -72,14 +78,17 @@ public class CommonsPoolTargetSourceTests extends TestCase { @@ -72,14 +78,17 @@ public class CommonsPoolTargetSourceTests extends TestCase {
//assertEquals(INITIAL_COUNT + 1, apartment.getCount() );
}
@Test
public void testFunctionality() {
testFunctionality("pooled");
}
@Test
public void testFunctionalityWithNoInterceptors() {
testFunctionality("pooledNoInterceptors");
}
@Test
public void testConfigMixin() {
SideEffectBean pooled = (SideEffectBean) beanFactory.getBean("pooledWithMixin");
assertEquals(INITIAL_COUNT, pooled.getCount());
@ -94,6 +103,7 @@ public class CommonsPoolTargetSourceTests extends TestCase { @@ -94,6 +103,7 @@ public class CommonsPoolTargetSourceTests extends TestCase {
assertEquals(25, conf.getMaxSize());
}
@Test
public void testTargetSourceSerializableWithoutConfigMixin() throws Exception {
CommonsPoolTargetSource cpts = (CommonsPoolTargetSource) beanFactory.getBean("personPoolTargetSource");
@ -102,6 +112,7 @@ public class CommonsPoolTargetSourceTests extends TestCase { @@ -102,6 +112,7 @@ public class CommonsPoolTargetSourceTests extends TestCase {
}
@Test
public void testProxySerializableWithoutConfigMixin() throws Exception {
Person pooled = (Person) beanFactory.getBean("pooledPerson");
@ -115,6 +126,7 @@ public class CommonsPoolTargetSourceTests extends TestCase { @@ -115,6 +126,7 @@ public class CommonsPoolTargetSourceTests extends TestCase {
assertEquals(25, serialized.getAge());
}
@Test
public void testHitMaxSize() throws Exception {
int maxSize = 10;
@ -150,6 +162,7 @@ public class CommonsPoolTargetSourceTests extends TestCase { @@ -150,6 +162,7 @@ public class CommonsPoolTargetSourceTests extends TestCase {
}
}
@Test
public void testHitMaxSizeLoadedFromContext() throws Exception {
Advised person = (Advised) beanFactory.getBean("maxSizePooledPerson");
CommonsPoolTargetSource targetSource = (CommonsPoolTargetSource) person.getTargetSource();
@ -182,6 +195,7 @@ public class CommonsPoolTargetSourceTests extends TestCase { @@ -182,6 +195,7 @@ public class CommonsPoolTargetSourceTests extends TestCase {
}
}
@Test
public void testSetWhenExhaustedAction() {
CommonsPoolTargetSource targetSource = new CommonsPoolTargetSource();
targetSource.setWhenExhaustedActionName("WHEN_EXHAUSTED_BLOCK");

Loading…
Cancel
Save