1
1
/*
2
- * Copyright 2002-2015 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
19
19
import java .util .Date ;
20
20
import java .util .concurrent .atomic .AtomicInteger ;
21
21
22
- import org .junit .Before ;
22
+ import org .junit .Ignore ;
23
23
import org .junit .Rule ;
24
24
import org .junit .Test ;
25
25
import org .junit .rules .ExpectedException ;
36
36
import org .springframework .tests .Assume ;
37
37
import org .springframework .tests .TestGroup ;
38
38
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 ;
41
45
42
46
/**
43
47
* Tests use of @EnableScheduling on @Configuration classes.
@@ -52,14 +56,10 @@ public class EnableSchedulingTests {
52
56
public final ExpectedException exception = ExpectedException .none ();
53
57
54
58
55
- @ Before
56
- public void setUp () {
57
- Assume .group (TestGroup .PERFORMANCE );
58
- }
59
-
60
-
61
59
@ Test
62
60
public void withFixedRateTask () throws InterruptedException {
61
+ Assume .group (TestGroup .PERFORMANCE );
62
+
63
63
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (FixedRateTaskConfig .class );
64
64
65
65
Thread .sleep (100 );
@@ -86,6 +86,8 @@ public void task() {
86
86
87
87
@ Test
88
88
public void withSubclass () throws InterruptedException {
89
+ Assume .group (TestGroup .PERFORMANCE );
90
+
89
91
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (FixedRateTaskConfigSubclass .class );
90
92
91
93
Thread .sleep (100 );
@@ -101,6 +103,8 @@ static class FixedRateTaskConfigSubclass extends FixedRateTaskConfig {
101
103
102
104
@ Test
103
105
public void withExplicitScheduler () throws InterruptedException {
106
+ Assume .group (TestGroup .PERFORMANCE );
107
+
104
108
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (ExplicitSchedulerConfig .class );
105
109
106
110
Thread .sleep (100 );
@@ -136,6 +140,7 @@ public void task() {
136
140
}
137
141
138
142
143
+ @ Ignore ("Disabled until SPR-14030 is resolved" )
139
144
@ Test
140
145
@ SuppressWarnings ("resource" )
141
146
public void withExplicitSchedulerAmbiguity_andSchedulingEnabled () {
@@ -171,6 +176,8 @@ public void task() {
171
176
172
177
@ Test
173
178
public void withExplicitScheduledTaskRegistrar () throws InterruptedException {
179
+ Assume .group (TestGroup .PERFORMANCE );
180
+
174
181
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (
175
182
ExplicitScheduledTaskRegistrarConfig .class );
176
183
@@ -251,6 +258,7 @@ public TaskScheduler taskScheduler2() {
251
258
}
252
259
253
260
261
+ @ Ignore ("Disabled until SPR-14030 is resolved" )
254
262
@ Test
255
263
@ SuppressWarnings ("resource" )
256
264
public void withAmbiguousTaskSchedulers_andSingleTask () {
@@ -286,6 +294,8 @@ public TaskScheduler taskScheduler2() {
286
294
287
295
@ Test
288
296
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrarBean () throws InterruptedException {
297
+ Assume .group (TestGroup .PERFORMANCE );
298
+
289
299
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (
290
300
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrar .class );
291
301
@@ -338,6 +348,8 @@ public TaskScheduler taskScheduler2() {
338
348
339
349
@ Test
340
350
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute () throws InterruptedException {
351
+ Assume .group (TestGroup .PERFORMANCE );
352
+
341
353
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (
342
354
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute .class );
343
355
@@ -384,6 +396,8 @@ public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
384
396
385
397
@ Test
386
398
public void withTaskAddedVia_configureTasks () throws InterruptedException {
399
+ Assume .group (TestGroup .PERFORMANCE );
400
+
387
401
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (
388
402
SchedulingEnabled_withTaskAddedVia_configureTasks .class );
389
403
@@ -424,6 +438,8 @@ public void run() {
424
438
425
439
@ Test
426
440
public void withTriggerTask () throws InterruptedException {
441
+ Assume .group (TestGroup .PERFORMANCE );
442
+
427
443
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (TriggerTaskConfig .class );
428
444
429
445
Thread .sleep (100 );
@@ -464,6 +480,8 @@ public Date nextExecutionTime(TriggerContext triggerContext) {
464
480
465
481
@ Test
466
482
public void withInitiallyDelayedFixedRateTask () throws InterruptedException {
483
+ Assume .group (TestGroup .PERFORMANCE );
484
+
467
485
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (
468
486
FixedRateTaskConfig_withInitialDelay .class );
469
487
0 commit comments