1
1
package org .zendesk .client .v2 ;
2
2
3
3
import org .apache .commons .lang3 .time .DateUtils ;
4
+ import org .awaitility .Awaitility ;
4
5
import org .hamcrest .CoreMatchers ;
5
6
import org .hamcrest .Matchers ;
6
7
import org .hamcrest .core .IsCollectionContaining ;
81
82
import static org .hamcrest .Matchers .greaterThan ;
82
83
import static org .hamcrest .Matchers .hasSize ;
83
84
import static org .hamcrest .Matchers .isEmptyString ;
84
- import static org .hamcrest .Matchers .lessThan ;
85
85
import static org .hamcrest .Matchers .lessThanOrEqualTo ;
86
86
import static org .hamcrest .core .StringContains .containsString ;
87
87
import static org .junit .Assert .assertEquals ;
@@ -120,6 +120,9 @@ public static void loadConfig() {
120
120
config = ZendeskConfig .load ();
121
121
assumeThat ("We have a configuration" , config , notNullValue ());
122
122
assumeThat ("Configuration has an url" , config .getProperty ("url" ), not (isEmptyString ()));
123
+ Awaitility .setDefaultTimeout (2 , TimeUnit .MINUTES );
124
+ Awaitility .setDefaultPollDelay (10 , TimeUnit .SECONDS );
125
+ Awaitility .setDefaultPollInterval (20 , TimeUnit .SECONDS );
123
126
}
124
127
125
128
public void assumeHaveToken () {
@@ -1874,8 +1877,8 @@ private JobStatus waitJobCompletion(final JobStatus result) {
1874
1877
assertNotNull (result .getId ());
1875
1878
assertNotNull (result .getStatus ());
1876
1879
1877
- // Let's wait for its completion (5 seconds max)
1878
- await ().atMost ( 10 , TimeUnit . SECONDS ). until (() ->
1880
+ // Let's wait for its completion (30 seconds max)
1881
+ await ().until (() ->
1879
1882
instance .getJobStatus (result ).getStatus () == JobStatus .JobStatusEnum .completed );
1880
1883
1881
1884
// Let's validate and return the completed result
@@ -1894,7 +1897,7 @@ private JobStatus waitJobCompletion(final JobStatus result) {
1894
1897
*/
1895
1898
private void waitTicketDeleted (long ticketId ) {
1896
1899
// Wait for the confirmation
1897
- await ().atMost ( 10 , TimeUnit . SECONDS ). until (() -> StreamSupport
1900
+ await ().until (() -> StreamSupport
1898
1901
.stream (instance .getDeletedTickets ("id" , SortOrder .DESCENDING ).spliterator (), false )
1899
1902
.map (DeletedTicket ::getId )
1900
1903
.collect (Collectors .toList ())
@@ -1908,7 +1911,7 @@ private void waitTicketDeleted(long ticketId) {
1908
1911
*/
1909
1912
private void waitTicketsDeleted (Long [] ticketsIds ) {
1910
1913
// Wait for the confirmation
1911
- await ().atMost ( 10 , TimeUnit . SECONDS ). until (() -> StreamSupport
1914
+ await ().until (() -> StreamSupport
1912
1915
.stream (instance .getDeletedTickets ("id" , SortOrder .DESCENDING ).spliterator (), false )
1913
1916
.map (DeletedTicket ::getId )
1914
1917
.collect (Collectors .toList ())
0 commit comments