Skip to content

Commit 89b443c

Browse files
committed
Allow for more async running time in succeedsWhenSubclassProxyAndScheduledMethodNotPresentOnInterface
After all, this test fails quite often as part of the CI build...
1 parent b8d8633 commit 89b443c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,28 @@
1616

1717
package org.springframework.scheduling.annotation;
1818

19-
import static org.easymock.EasyMock.createMock;
20-
import static org.easymock.EasyMock.replay;
21-
import static org.hamcrest.CoreMatchers.is;
22-
import static org.hamcrest.Matchers.greaterThan;
23-
import static org.junit.Assert.assertThat;
24-
import static org.junit.Assert.assertTrue;
25-
import static org.junit.Assert.fail;
26-
2719
import java.util.concurrent.atomic.AtomicInteger;
2820

2921
import org.junit.Test;
22+
3023
import org.springframework.aop.support.AopUtils;
3124
import org.springframework.beans.factory.BeanCreationException;
3225
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3326
import org.springframework.context.annotation.Bean;
3427
import org.springframework.context.annotation.Configuration;
3528
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
3629
import org.springframework.dao.support.PersistenceExceptionTranslator;
37-
import org.springframework.scheduling.annotation.EnableScheduling;
3830
import org.springframework.stereotype.Repository;
3931
import org.springframework.transaction.CallCountingTransactionManager;
4032
import org.springframework.transaction.PlatformTransactionManager;
4133
import org.springframework.transaction.annotation.EnableTransactionManagement;
4234
import org.springframework.transaction.annotation.Transactional;
4335

36+
import static org.easymock.EasyMock.*;
37+
import static org.hamcrest.CoreMatchers.is;
38+
import static org.hamcrest.Matchers.*;
39+
import static org.junit.Assert.*;
40+
4441
/**
4542
* Integration tests cornering bug SPR-8651, which revealed that @Scheduled methods may
4643
* not work well with beans that have already been proxied for other reasons such
@@ -58,7 +55,8 @@ public void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() {
5855
try {
5956
ctx.refresh();
6057
fail("expected exception");
61-
} catch (BeanCreationException ex) {
58+
}
59+
catch (BeanCreationException ex) {
6260
assertTrue(ex.getRootCause().getMessage().startsWith("@Scheduled method 'scheduled' found"));
6361
}
6462
}
@@ -69,7 +67,7 @@ public void succeedsWhenSubclassProxyAndScheduledMethodNotPresentOnInterface() t
6967
ctx.register(Config.class, SubclassProxyTxConfig.class, RepoConfigA.class);
7068
ctx.refresh();
7169

72-
Thread.sleep(50); // allow @Scheduled method to be called several times
70+
Thread.sleep(100); // allow @Scheduled method to be called several times
7371

7472
MyRepository repository = ctx.getBean(MyRepository.class);
7573
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
@@ -93,6 +91,7 @@ public void succeedsWhenJdkProxyAndScheduledMethodIsPresentOnInterface() throws
9391
assertThat("no transactions were committed", txManager.commits, greaterThan(0));
9492
}
9593

94+
9695
@Configuration
9796
@EnableTransactionManagement
9897
static class JdkProxyTxConfig { }
@@ -179,5 +178,5 @@ public int getInvocationCount() {
179178
return this.count.get();
180179
}
181180
}
182-
}
183181

182+
}

0 commit comments

Comments
 (0)