22
22
23
23
import com .datastax .oss .driver .api .core .CqlSession ;
24
24
import com .datastax .oss .driver .api .core .cql .Row ;
25
+ import com .datastax .oss .driver .api .core .cql .SimpleStatement ;
25
26
import com .datastax .oss .driver .api .core .data .UdtValue ;
26
27
import com .datastax .oss .driver .api .core .type .UserDefinedType ;
27
28
import com .datastax .oss .driver .api .core .type .codec .TypeCodec ;
28
29
import com .datastax .oss .driver .api .testinfra .ccm .CcmRule ;
29
30
import com .datastax .oss .driver .api .testinfra .session .SessionRule ;
30
31
import com .datastax .oss .driver .categories .ParallelizableTests ;
32
+ import java .time .Duration ;
31
33
import java .util .Objects ;
32
34
import org .junit .Rule ;
33
35
import org .junit .Test ;
@@ -47,8 +49,13 @@ public class UdtCodecIT {
47
49
@ Test
48
50
public void should_decoding_udt_be_backward_compatible () {
49
51
CqlSession session = sessionRule .session ();
50
- session .execute ("CREATE TYPE test_type_1 (a text, b int)" );
51
- session .execute ("CREATE TABLE test_table_1 (e int primary key, f frozen<test_type_1>)" );
52
+ session .execute (
53
+ SimpleStatement .newInstance ("CREATE TYPE test_type_1 (a text, b int)" )
54
+ .setTimeout (Duration .ofSeconds (20 )));
55
+ session .execute (
56
+ SimpleStatement .newInstance (
57
+ "CREATE TABLE test_table_1 (e int primary key, f frozen<test_type_1>)" )
58
+ .setTimeout (Duration .ofSeconds (20 )));
52
59
// insert a row using version 1 of the UDT schema
53
60
session .execute ("INSERT INTO test_table_1(e, f) VALUES(1, {a: 'a', b: 1})" );
54
61
UserDefinedType udt =
@@ -59,7 +66,9 @@ public void should_decoding_udt_be_backward_compatible() {
59
66
.orElseThrow (IllegalStateException ::new );
60
67
TypeCodec <?> oldCodec = session .getContext ().getCodecRegistry ().codecFor (udt );
61
68
// update UDT schema
62
- session .execute ("ALTER TYPE test_type_1 add i text" );
69
+ session .execute (
70
+ SimpleStatement .newInstance ("ALTER TYPE test_type_1 add i text" )
71
+ .setTimeout (Duration .ofSeconds (20 )));
63
72
// insert a row using version 2 of the UDT schema
64
73
session .execute ("INSERT INTO test_table_1(e, f) VALUES(2, {a: 'b', b: 2, i: 'b'})" );
65
74
Row row =
0 commit comments