Skip to content

Commit 5593f5b

Browse files
committed
change table and type names
1 parent 7ac257a commit 5593f5b

File tree

2 files changed

+52
-41
lines changed

2 files changed

+52
-41
lines changed

integration-tests/src/test/java/com/datastax/oss/driver/core/cql/PreparedStatementCachingIT.java

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ private void invalidationResultSetTest(
194194
Consumer<CqlSession> setupTestSchema, Set<String> expectedChangedTypes) {
195195
invalidationTestInner(
196196
setupTestSchema,
197-
"select f from test_table_1 where e = ?",
198-
"select h from test_table_2 where g = ?",
197+
"select f from test_table_caching_1 where e = ?",
198+
"select h from test_table_caching_2 where g = ?",
199199
expectedChangedTypes);
200200
}
201201

@@ -206,8 +206,8 @@ private void invalidationVariableDefsTest(
206206
String condition = isCollection ? "contains ?" : "= ?";
207207
invalidationTestInner(
208208
setupTestSchema,
209-
String.format("select e from test_table_1 where f %s allow filtering", condition),
210-
String.format("select g from test_table_2 where h %s allow filtering", condition),
209+
String.format("select e from test_table_caching_1 where f %s allow filtering", condition),
210+
String.format("select g from test_table_caching_2 where h %s allow filtering", condition),
211211
expectedChangedTypes);
212212
}
213213

@@ -263,8 +263,8 @@ private void invalidationTestInner(
263263
preparedStmtCacheRemoveLatch.countDown();
264264
});
265265

266-
// alter test_type_2 to trigger cache invalidation and above events
267-
session.execute("ALTER TYPE test_type_2 add i blob");
266+
// alter test_type_caching_2 to trigger cache invalidation and above events
267+
session.execute("ALTER TYPE test_type_caching_2 add i blob");
268268

269269
session.checkSchemaAgreement();
270270

@@ -297,17 +297,20 @@ private void invalidationTestInner(
297297

298298
Consumer<CqlSession> setupCacheEntryTestBasic =
299299
(session) -> {
300-
session.execute("CREATE TYPE test_type_1 (a text, b int)");
301-
session.execute("CREATE TYPE test_type_2 (c int, d text)");
302-
session.execute("CREATE TABLE test_table_1 (e int primary key, f frozen<test_type_1>)");
303-
session.execute("CREATE TABLE test_table_2 (g int primary key, h frozen<test_type_2>)");
300+
session.execute("CREATE TYPE test_type_caching_1 (a text, b int)");
301+
session.execute("CREATE TYPE test_type_caching_2 (c int, d text)");
302+
session.execute(
303+
"CREATE TABLE test_table_caching_1 (e int primary key, f frozen<test_type_caching_1>)");
304+
session.execute(
305+
"CREATE TABLE test_table_caching_2 (g int primary key, h frozen<test_type_caching_2>)");
304306
};
305307

306308
@Test
307309
public void should_invalidate_cache_entry_on_basic_udt_change_result_set() {
308310
SchemaChangeSynchronizer.withLock(
309311
() -> {
310-
invalidationResultSetTest(setupCacheEntryTestBasic, ImmutableSet.of("test_type_2"));
312+
invalidationResultSetTest(
313+
setupCacheEntryTestBasic, ImmutableSet.of("test_type_caching_2"));
311314
});
312315
}
313316

@@ -316,25 +319,26 @@ public void should_invalidate_cache_entry_on_basic_udt_change_variable_defs() {
316319
SchemaChangeSynchronizer.withLock(
317320
() -> {
318321
invalidationVariableDefsTest(
319-
setupCacheEntryTestBasic, false, ImmutableSet.of("test_type_2"));
322+
setupCacheEntryTestBasic, false, ImmutableSet.of("test_type_caching_2"));
320323
});
321324
}
322325

323326
Consumer<CqlSession> setupCacheEntryTestCollection =
324327
(session) -> {
325-
session.execute("CREATE TYPE test_type_1 (a text, b int)");
326-
session.execute("CREATE TYPE test_type_2 (c int, d text)");
328+
session.execute("CREATE TYPE test_type_caching_1 (a text, b int)");
329+
session.execute("CREATE TYPE test_type_caching_2 (c int, d text)");
327330
session.execute(
328-
"CREATE TABLE test_table_1 (e int primary key, f list<frozen<test_type_1>>)");
331+
"CREATE TABLE test_table_caching_1 (e int primary key, f list<frozen<test_type_caching_1>>)");
329332
session.execute(
330-
"CREATE TABLE test_table_2 (g int primary key, h list<frozen<test_type_2>>)");
333+
"CREATE TABLE test_table_caching_2 (g int primary key, h list<frozen<test_type_caching_2>>)");
331334
};
332335

333336
@Test
334337
public void should_invalidate_cache_entry_on_collection_udt_change_result_set() {
335338
SchemaChangeSynchronizer.withLock(
336339
() -> {
337-
invalidationResultSetTest(setupCacheEntryTestCollection, ImmutableSet.of("test_type_2"));
340+
invalidationResultSetTest(
341+
setupCacheEntryTestCollection, ImmutableSet.of("test_type_caching_2"));
338342
});
339343
}
340344

@@ -343,25 +347,26 @@ public void should_invalidate_cache_entry_on_collection_udt_change_variable_defs
343347
SchemaChangeSynchronizer.withLock(
344348
() -> {
345349
invalidationVariableDefsTest(
346-
setupCacheEntryTestCollection, true, ImmutableSet.of("test_type_2"));
350+
setupCacheEntryTestCollection, true, ImmutableSet.of("test_type_caching_2"));
347351
});
348352
}
349353

350354
Consumer<CqlSession> setupCacheEntryTestTuple =
351355
(session) -> {
352-
session.execute("CREATE TYPE test_type_1 (a text, b int)");
353-
session.execute("CREATE TYPE test_type_2 (c int, d text)");
356+
session.execute("CREATE TYPE test_type_caching_1 (a text, b int)");
357+
session.execute("CREATE TYPE test_type_caching_2 (c int, d text)");
354358
session.execute(
355-
"CREATE TABLE test_table_1 (e int primary key, f tuple<int, test_type_1, text>)");
359+
"CREATE TABLE test_table_caching_1 (e int primary key, f tuple<int, test_type_caching_1, text>)");
356360
session.execute(
357-
"CREATE TABLE test_table_2 (g int primary key, h tuple<text, test_type_2, int>)");
361+
"CREATE TABLE test_table_caching_2 (g int primary key, h tuple<text, test_type_caching_2, int>)");
358362
};
359363

360364
@Test
361365
public void should_invalidate_cache_entry_on_tuple_udt_change_result_set() {
362366
SchemaChangeSynchronizer.withLock(
363367
() -> {
364-
invalidationResultSetTest(setupCacheEntryTestTuple, ImmutableSet.of("test_type_2"));
368+
invalidationResultSetTest(
369+
setupCacheEntryTestTuple, ImmutableSet.of("test_type_caching_2"));
365370
});
366371
}
367372

@@ -370,26 +375,29 @@ public void should_invalidate_cache_entry_on_tuple_udt_change_variable_defs() {
370375
SchemaChangeSynchronizer.withLock(
371376
() -> {
372377
invalidationVariableDefsTest(
373-
setupCacheEntryTestTuple, false, ImmutableSet.of("test_type_2"));
378+
setupCacheEntryTestTuple, false, ImmutableSet.of("test_type_caching_2"));
374379
});
375380
}
376381

377382
Consumer<CqlSession> setupCacheEntryTestNested =
378383
(session) -> {
379-
session.execute("CREATE TYPE test_type_1 (a text, b int)");
380-
session.execute("CREATE TYPE test_type_2 (c int, d text)");
381-
session.execute("CREATE TYPE test_type_3 (e frozen<test_type_1>, f int)");
382-
session.execute("CREATE TYPE test_type_4 (g int, h frozen<test_type_2>)");
383-
session.execute("CREATE TABLE test_table_1 (e int primary key, f frozen<test_type_3>)");
384-
session.execute("CREATE TABLE test_table_2 (g int primary key, h frozen<test_type_4>)");
384+
session.execute("CREATE TYPE test_type_caching_1 (a text, b int)");
385+
session.execute("CREATE TYPE test_type_caching_2 (c int, d text)");
386+
session.execute("CREATE TYPE test_type_caching_3 (e frozen<test_type_caching_1>, f int)");
387+
session.execute("CREATE TYPE test_type_caching_4 (g int, h frozen<test_type_caching_2>)");
388+
session.execute(
389+
"CREATE TABLE test_table_caching_1 (e int primary key, f frozen<test_type_caching_3>)");
390+
session.execute(
391+
"CREATE TABLE test_table_caching_2 (g int primary key, h frozen<test_type_caching_4>)");
385392
};
386393

387394
@Test
388395
public void should_invalidate_cache_entry_on_nested_udt_change_result_set() {
389396
SchemaChangeSynchronizer.withLock(
390397
() -> {
391398
invalidationResultSetTest(
392-
setupCacheEntryTestNested, ImmutableSet.of("test_type_2", "test_type_4"));
399+
setupCacheEntryTestNested,
400+
ImmutableSet.of("test_type_caching_2", "test_type_caching_4"));
393401
});
394402
}
395403

@@ -398,7 +406,9 @@ public void should_invalidate_cache_entry_on_nested_udt_change_variable_defs() {
398406
SchemaChangeSynchronizer.withLock(
399407
() -> {
400408
invalidationVariableDefsTest(
401-
setupCacheEntryTestNested, false, ImmutableSet.of("test_type_2", "test_type_4"));
409+
setupCacheEntryTestNested,
410+
false,
411+
ImmutableSet.of("test_type_caching_2", "test_type_caching_4"));
402412
});
403413
}
404414

integration-tests/src/test/java/com/datastax/oss/driver/internal/core/type/codec/UdtCodecIT.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,30 @@ public class UdtCodecIT {
5050
public void should_decoding_udt_be_backward_compatible() {
5151
CqlSession session = sessionRule.session();
5252
session.execute(
53-
SimpleStatement.newInstance("CREATE TYPE test_type_1 (a text, b int)")
54-
.setTimeout(Duration.ofSeconds(120)));
53+
SimpleStatement.newInstance("CREATE TYPE test_type_udt_1 (a text, b int)")
54+
.setTimeout(Duration.ofSeconds(20)));
5555
session.execute(
5656
SimpleStatement.newInstance(
57-
"CREATE TABLE test_table_1 (e int primary key, f frozen<test_type_1>)")
58-
.setTimeout(Duration.ofSeconds(120)));
57+
"CREATE TABLE test_table_udt_1 (e int primary key, f frozen<test_type_udt_1>)")
58+
.setTimeout(Duration.ofSeconds(20)));
5959
// insert a row using version 1 of the UDT schema
60-
session.execute("INSERT INTO test_table_1(e, f) VALUES(1, {a: 'a', b: 1})");
60+
session.execute("INSERT INTO test_table_udt_1(e, f) VALUES(1, {a: 'a', b: 1})");
6161
UserDefinedType udt =
6262
session
6363
.getMetadata()
6464
.getKeyspace(sessionRule.keyspace())
65-
.flatMap(ks -> ks.getUserDefinedType("test_type_1"))
65+
.flatMap(ks -> ks.getUserDefinedType("test_type_udt_1"))
6666
.orElseThrow(IllegalStateException::new);
6767
TypeCodec<?> oldCodec = session.getContext().getCodecRegistry().codecFor(udt);
6868
// update UDT schema
6969
session.execute(
70-
SimpleStatement.newInstance("ALTER TYPE test_type_1 add i text")
70+
SimpleStatement.newInstance("ALTER TYPE test_type_udt_1 add i text")
7171
.setTimeout(Duration.ofSeconds(20)));
7272
// insert a row using version 2 of the UDT schema
73-
session.execute("INSERT INTO test_table_1(e, f) VALUES(2, {a: 'b', b: 2, i: 'b'})");
73+
session.execute("INSERT INTO test_table_udt_1(e, f) VALUES(2, {a: 'b', b: 2, i: 'b'})");
7474
Row row =
75-
Objects.requireNonNull(session.execute("SELECT f FROM test_table_1 WHERE e = ?", 2).one());
75+
Objects.requireNonNull(
76+
session.execute("SELECT f FROM test_table_udt_1 WHERE e = ?", 2).one());
7677
// Try to read new row with old codec. Using row.getUdtValue() would not cause any issues,
7778
// because new codec will be automatically registered (using all 3 attributes).
7879
// If application leverages generic row.get(String, Codec) method, data reading with old codec

0 commit comments

Comments
 (0)