Skip to content

Commit 5045579

Browse files
committed
Revise EnableSchedulingTests
- Fast tests now always run (i.e., are no longer limited to the performance build - Failing tests have been @ignore'd Issue: SPR-14030
1 parent a905412 commit 5045579

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
1919
import java.util.Date;
2020
import java.util.concurrent.atomic.AtomicInteger;
2121

22-
import org.junit.Before;
22+
import org.junit.Ignore;
2323
import org.junit.Rule;
2424
import org.junit.Test;
2525
import org.junit.rules.ExpectedException;
@@ -36,8 +36,12 @@
3636
import org.springframework.tests.Assume;
3737
import org.springframework.tests.TestGroup;
3838

39-
import static org.hamcrest.Matchers.*;
40-
import static org.junit.Assert.*;
39+
import static org.hamcrest.Matchers.both;
40+
import static org.hamcrest.Matchers.greaterThan;
41+
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
42+
import static org.hamcrest.Matchers.lessThanOrEqualTo;
43+
import static org.hamcrest.Matchers.startsWith;
44+
import static org.junit.Assert.assertThat;
4145

4246
/**
4347
* Tests use of @EnableScheduling on @Configuration classes.
@@ -52,14 +56,10 @@ public class EnableSchedulingTests {
5256
public final ExpectedException exception = ExpectedException.none();
5357

5458

55-
@Before
56-
public void setUp() {
57-
Assume.group(TestGroup.PERFORMANCE);
58-
}
59-
60-
6159
@Test
6260
public void withFixedRateTask() throws InterruptedException {
61+
Assume.group(TestGroup.PERFORMANCE);
62+
6363
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfig.class);
6464

6565
Thread.sleep(100);
@@ -86,6 +86,8 @@ public void task() {
8686

8787
@Test
8888
public void withSubclass() throws InterruptedException {
89+
Assume.group(TestGroup.PERFORMANCE);
90+
8991
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfigSubclass.class);
9092

9193
Thread.sleep(100);
@@ -101,6 +103,8 @@ static class FixedRateTaskConfigSubclass extends FixedRateTaskConfig {
101103

102104
@Test
103105
public void withExplicitScheduler() throws InterruptedException {
106+
Assume.group(TestGroup.PERFORMANCE);
107+
104108
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ExplicitSchedulerConfig.class);
105109

106110
Thread.sleep(100);
@@ -136,6 +140,7 @@ public void task() {
136140
}
137141

138142

143+
@Ignore("Disabled until SPR-14030 is resolved")
139144
@Test
140145
@SuppressWarnings("resource")
141146
public void withExplicitSchedulerAmbiguity_andSchedulingEnabled() {
@@ -171,6 +176,8 @@ public void task() {
171176

172177
@Test
173178
public void withExplicitScheduledTaskRegistrar() throws InterruptedException {
179+
Assume.group(TestGroup.PERFORMANCE);
180+
174181
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
175182
ExplicitScheduledTaskRegistrarConfig.class);
176183

@@ -251,6 +258,7 @@ public TaskScheduler taskScheduler2() {
251258
}
252259

253260

261+
@Ignore("Disabled until SPR-14030 is resolved")
254262
@Test
255263
@SuppressWarnings("resource")
256264
public void withAmbiguousTaskSchedulers_andSingleTask() {
@@ -286,6 +294,8 @@ public TaskScheduler taskScheduler2() {
286294

287295
@Test
288296
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrarBean() throws InterruptedException {
297+
Assume.group(TestGroup.PERFORMANCE);
298+
289299
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
290300
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrar.class);
291301

@@ -338,6 +348,8 @@ public TaskScheduler taskScheduler2() {
338348

339349
@Test
340350
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute() throws InterruptedException {
351+
Assume.group(TestGroup.PERFORMANCE);
352+
341353
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
342354
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute.class);
343355

@@ -384,6 +396,8 @@ public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
384396

385397
@Test
386398
public void withTaskAddedVia_configureTasks() throws InterruptedException {
399+
Assume.group(TestGroup.PERFORMANCE);
400+
387401
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
388402
SchedulingEnabled_withTaskAddedVia_configureTasks.class);
389403

@@ -424,6 +438,8 @@ public void run() {
424438

425439
@Test
426440
public void withTriggerTask() throws InterruptedException {
441+
Assume.group(TestGroup.PERFORMANCE);
442+
427443
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(TriggerTaskConfig.class);
428444

429445
Thread.sleep(100);
@@ -464,6 +480,8 @@ public Date nextExecutionTime(TriggerContext triggerContext) {
464480

465481
@Test
466482
public void withInitiallyDelayedFixedRateTask() throws InterruptedException {
483+
Assume.group(TestGroup.PERFORMANCE);
484+
467485
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
468486
FixedRateTaskConfig_withInitialDelay.class);
469487

0 commit comments

Comments
 (0)