Increase timeout for PollingConsumerEndpointTests

https://build.spring.io/browse/INT-SI50X-20

Looks like 5 seconds is not enough to wait for the test completion,
especially on CI server

* Refactor `PollingConsumerEndpointTests` to use `OnlyOnceTrigger`
from the test-support module instead of local `Trigger` implementation
* Increase timeout for latch in the `OnlyOnceTrigger` to 10 seconds

**Cherry-pick to 5.0.x**

(cherry picked from commit a65d05c)
This commit is contained in:
Artem Bilan
2018-04-02 14:44:56 -04:00
parent de9aeac8bf
commit 9ce329f1c6
2 changed files with 81 additions and 122 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@@ -28,6 +28,8 @@ import org.springframework.scheduling.TriggerContext;
*
* @author Gunnar Hillert
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.2
*
*/
@@ -47,7 +49,6 @@ public class OnlyOnceTrigger implements Trigger {
@Override
public Date nextExecutionTime(TriggerContext triggerContext) {
if (this.hasRun.getAndSet(true)) {
this.latch.countDown();
return null;
@@ -95,7 +96,7 @@ public class OnlyOnceTrigger implements Trigger {
public void await() {
try {
if (!this.latch.await(5000, TimeUnit.MILLISECONDS)) {
if (!this.latch.await(10000, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("test latch.await() did not count down");
}
}