1111
1212public interface DeadlineTests extends ConnectionAware {
1313 @ RetryingTest (10 )
14- default void testDefaultDeadline () throws Throwable {
14+ default void testDefaultDeadline () {
1515 KurrentDBClient client = getDatabase ().connectWith (opts ->
1616 opts .defaultDeadline (1 )
1717 .maxDiscoverAttempts (3 ));
@@ -21,11 +21,11 @@ default void testDefaultDeadline() throws Throwable {
2121 ExecutionException e = Assertions .assertThrows (ExecutionException .class , () -> client .appendToStream ("toto" , data ).get ());
2222 StatusRuntimeException status = (StatusRuntimeException ) e .getCause ();
2323
24- Assertions .assertEquals (status .getStatus ().getCode (), Status . Code . DEADLINE_EXCEEDED );
24+ Assertions .assertEquals (Status . Code . DEADLINE_EXCEEDED , status .getStatus ().getCode ());
2525 }
2626
2727 @ RetryingTest (3 )
28- default void testOptionLevelDeadline () throws Throwable {
28+ default void testOptionLevelDeadline () {
2929 KurrentDBClient client = getDatabase ().defaultClient ();
3030 UUID id = UUID .randomUUID ();
3131
@@ -34,6 +34,59 @@ default void testOptionLevelDeadline() throws Throwable {
3434 ExecutionException e = Assertions .assertThrows (ExecutionException .class , () -> client .appendToStream ("toto" , options , data ).get ());
3535 StatusRuntimeException status = (StatusRuntimeException ) e .getCause ();
3636
37- Assertions .assertEquals (status .getStatus ().getCode (), Status .Code .DEADLINE_EXCEEDED );
37+ Assertions .assertEquals (Status .Code .DEADLINE_EXCEEDED , status .getStatus ().getCode ());
38+ }
39+
40+ @ RetryingTest (3 )
41+ default void testReadStreamWithDefaultDeadline () {
42+ KurrentDBClient client = getDatabase ().connectWith (opts ->
43+ opts .defaultDeadline (1 )
44+ .maxDiscoverAttempts (3 ));
45+
46+ ReadStreamOptions options = ReadStreamOptions .get ();
47+
48+ ExecutionException e = Assertions .assertThrows (ExecutionException .class , () -> client .readStream ("$users" , options ).get ());
49+ StatusRuntimeException status = (StatusRuntimeException ) e .getCause ();
50+
51+ Assertions .assertEquals (Status .Code .DEADLINE_EXCEEDED , status .getStatus ().getCode ());
52+ }
53+
54+ @ RetryingTest (3 )
55+ default void testReadStreamWithLevelDeadline () {
56+ KurrentDBClient client = getDefaultClient ();
57+
58+ ExecutionException e = Assertions .assertThrows (
59+ ExecutionException .class ,
60+ () -> client .readStream ("$users" , ReadStreamOptions .get ().deadline (1 )).get ()
61+ );
62+ StatusRuntimeException status = (StatusRuntimeException ) e .getCause ();
63+
64+ Assertions .assertEquals (Status .Code .DEADLINE_EXCEEDED , status .getStatus ().getCode ());
65+ }
66+
67+ @ RetryingTest (3 )
68+ default void testReadAllWithDefaultDeadline () {
69+ KurrentDBClient client = getDatabase ().connectWith (opts ->
70+ opts .defaultDeadline (1 )
71+ .maxDiscoverAttempts (3 ));
72+
73+ ReadAllOptions options = ReadAllOptions .get ();
74+
75+ ExecutionException e = Assertions .assertThrows (ExecutionException .class , () -> client .readAll (options ).get ());
76+ StatusRuntimeException status = (StatusRuntimeException ) e .getCause ();
77+
78+ Assertions .assertEquals (Status .Code .DEADLINE_EXCEEDED , status .getStatus ().getCode ());
79+ }
80+
81+ @ RetryingTest (3 )
82+ default void testReadAllWithLevelDeadline () {
83+ KurrentDBClient client = getDefaultClient ();
84+
85+ ReadAllOptions options = ReadAllOptions .get ().deadline (1 );
86+
87+ ExecutionException e = Assertions .assertThrows (ExecutionException .class , () -> client .readAll (options ).get ());
88+ StatusRuntimeException status = (StatusRuntimeException ) e .getCause ();
89+
90+ Assertions .assertEquals (Status .Code .DEADLINE_EXCEEDED , status .getStatus ().getCode ());
3891 }
3992}
0 commit comments