@@ -99,11 +99,7 @@ private ElasticCatalogBuilder catalogBuilder() {
99
99
}
100
100
101
101
@ Test
102
- public void testListDatabases () throws DatabaseNotExistException , TableNotExistException {
103
- // given
104
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
105
- container .getElasticPort ());
106
-
102
+ public void testListDatabases () {
107
103
// when
108
104
ElasticCatalog catalog = catalogBuilder ().build ();
109
105
@@ -114,11 +110,7 @@ public void testListDatabases() throws DatabaseNotExistException, TableNotExistE
114
110
}
115
111
116
112
@ Test
117
- public void testListTables () throws DatabaseNotExistException , InterruptedException {
118
- // given
119
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
120
- container .getElasticPort ());
121
-
113
+ public void testListTables () throws DatabaseNotExistException {
122
114
// when
123
115
ElasticCatalog catalog = catalogBuilder ().build ();
124
116
@@ -140,10 +132,6 @@ public void testListTables() throws DatabaseNotExistException, InterruptedExcept
140
132
141
133
@ Test
142
134
public void testTableFiltering () throws DatabaseNotExistException {
143
- // given
144
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
145
- container .getElasticPort ());
146
-
147
135
// when
148
136
ElasticCatalog catalog = catalogBuilder ()
149
137
.indexFilterResolver (IndexFilterResolver .of ("test_m.*" , "test_mi.*" ))
@@ -159,11 +147,7 @@ public void testTableFiltering() throws DatabaseNotExistException {
159
147
}
160
148
161
149
@ Test
162
- public void testTableExists () throws DatabaseNotExistException {
163
- // given
164
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
165
- container .getElasticPort ());
166
-
150
+ public void testTableExists () {
167
151
// when
168
152
ElasticCatalog catalog = catalogBuilder ().build ();
169
153
@@ -193,10 +177,6 @@ public void testTableNotExists() {
193
177
194
178
@ Test
195
179
public void testGetNonPartitionedTable () throws TableNotExistException {
196
- // given
197
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
198
- container .getElasticPort ());
199
-
200
180
// when
201
181
ElasticCatalog catalog = catalogBuilder ().build ();
202
182
CatalogBaseTable table = catalog .getTable (new ObjectPath (
@@ -214,9 +194,7 @@ public void testGetNonPartitionedTable() throws TableNotExistException {
214
194
@ Test
215
195
public void testGetTablePartitionedByTimestamp () throws TableNotExistException {
216
196
// given
217
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
218
- container .getElasticPort ());
219
- Map <String , String > properties = new HashMap <String , String >();
197
+ Map <String , String > properties = new HashMap <>();
220
198
properties .put ("properties.scan.test_multiple_records_table.partition.column.name" , "date_col" );
221
199
properties .put ("properties.scan.test_multiple_records_table.partition.number" , "10" );
222
200
@@ -238,9 +216,7 @@ public void testGetTablePartitionedByTimestamp() throws TableNotExistException {
238
216
@ Test
239
217
public void testGetTablePartitionedByInteger () throws TableNotExistException {
240
218
// given
241
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
242
- container .getElasticPort ());
243
- Map <String , String > properties = new HashMap <String , String >();
219
+ Map <String , String > properties = new HashMap <>();
244
220
properties .put ("properties.scan.test_multiple_records_table.partition.column.name" , "integer_col" );
245
221
properties .put ("properties.scan.test_multiple_records_table.partition.number" , "10" );
246
222
@@ -262,9 +238,7 @@ public void testGetTablePartitionedByInteger() throws TableNotExistException {
262
238
@ Test
263
239
public void testGetTableDefaultScanOptionsZeroRecords () throws TableNotExistException {
264
240
// given
265
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
266
- container .getElasticPort ());
267
- Map <String , String > properties = new HashMap <String , String >();
241
+ Map <String , String > properties = new HashMap <>();
268
242
properties .put ("catalog.default.scan.partition.column.name" , "date_col" );
269
243
properties .put ("catalog.default.scan.partition.size" , "100" );
270
244
@@ -287,9 +261,7 @@ public void testGetTableDefaultScanOptionsZeroRecords() throws TableNotExistExce
287
261
@ Test
288
262
public void testFailNoPartitionColumnProvided () throws TableNotExistException {
289
263
// given
290
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
291
- container .getElasticPort ());
292
- Map <String , String > properties = new HashMap <String , String >();
264
+ Map <String , String > properties = new HashMap <>();
293
265
properties .put ("properties.scan.test_multiple_records_table.partition.number" , "10" );
294
266
295
267
// when
@@ -307,9 +279,7 @@ public void testFailNoPartitionColumnProvided() throws TableNotExistException {
307
279
@ Test
308
280
public void testFailNoPartitionNumberProvided () throws TableNotExistException {
309
281
// given
310
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
311
- container .getElasticPort ());
312
- Map <String , String > properties = new HashMap <String , String >();
282
+ Map <String , String > properties = new HashMap <>();
313
283
properties .put ("properties.scan.test_multiple_records_table.partition.column.name" , "date_col" );
314
284
315
285
// when
@@ -327,9 +297,7 @@ public void testFailNoPartitionNumberProvided() throws TableNotExistException {
327
297
@ Test
328
298
public void testFailNoPartitionColumnInTable () throws TableNotExistException {
329
299
// given
330
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
331
- container .getElasticPort ());
332
- Map <String , String > properties = new HashMap <String , String >();
300
+ Map <String , String > properties = new HashMap <>();
333
301
properties .put ("properties.scan.test_missing_date_col_table.partition.column.name" , "date_col" );
334
302
properties .put ("properties.scan.test_missing_date_col_table.partition.number" , "10" );
335
303
@@ -348,9 +316,7 @@ public void testFailNoPartitionColumnInTable() throws TableNotExistException {
348
316
@ Test
349
317
public void testFailPartitionColumnNotSupported () throws TableNotExistException {
350
318
// given
351
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
352
- container .getElasticPort ());
353
- Map <String , String > properties = new HashMap <String , String >();
319
+ Map <String , String > properties = new HashMap <>();
354
320
properties .put ("properties.scan.test_single_record_table.partition.column.name" , "keyword_col" );
355
321
properties .put ("properties.scan.test_single_record_table.partition.number" , "10" );
356
322
@@ -369,9 +335,7 @@ public void testFailPartitionColumnNotSupported() throws TableNotExistException
369
335
@ Test
370
336
public void testFailInappropriatePartitionNumber () throws TableNotExistException {
371
337
// given
372
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
373
- container .getElasticPort ());
374
- Map <String , String > properties = new HashMap <String , String >();
338
+ Map <String , String > properties = new HashMap <>();
375
339
properties .put ("properties.scan.test_multiple_records_table.partition.column.name" , "date_col" );
376
340
properties .put ("properties.scan.test_multiple_records_table.partition.number" , "0" );
377
341
@@ -390,10 +354,6 @@ public void testFailInappropriatePartitionNumber() throws TableNotExistException
390
354
@ Disabled
391
355
@ Test
392
356
public void testUnsupportedDataTypeInTable () throws TableNotExistException {
393
- // given
394
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
395
- container .getElasticPort ());
396
-
397
357
// when
398
358
ElasticCatalog catalog = catalogBuilder ().build ();
399
359
try {
@@ -409,9 +369,7 @@ public void testUnsupportedDataTypeInTable() throws TableNotExistException {
409
369
@ Test
410
370
public void testGetTableDefaultCatalogScanPartitionProperties () throws TableNotExistException {
411
371
// given
412
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
413
- container .getElasticPort ());
414
- Map <String , String > properties = new HashMap <String , String >();
372
+ Map <String , String > properties = new HashMap <>();
415
373
properties .put ("catalog.default.scan.partition.column.name" , "date_col" );
416
374
properties .put ("catalog.default.scan.partition.size" , "5" );
417
375
@@ -432,9 +390,7 @@ public void testGetTableDefaultCatalogScanPartitionProperties() throws TableNotE
432
390
@ Test
433
391
public void testGetTableOverwriteCatalogScanProperties () throws TableNotExistException {
434
392
// given
435
- String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
436
- container .getElasticPort ());
437
- Map <String , String > properties = new HashMap <String , String >();
393
+ Map <String , String > properties = new HashMap <>();
438
394
properties .put ("properties.scan.test_multiple_records_table.partition.column.name" , "integer_col" );
439
395
properties .put ("properties.scan.test_multiple_records_table.partition.number" , "3" );
440
396
properties .put ("catalog.default.scan.partition.column.name" , "date_col" );
@@ -458,7 +414,7 @@ public void testGetTableIndexPattern() throws TableNotExistException, DatabaseNo
458
414
// given
459
415
String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
460
416
container .getElasticPort ());
461
- Map <String , String > properties = new HashMap <String , String >();
417
+ Map <String , String > properties = new HashMap <>();
462
418
properties .put ("properties.index.patterns" , "test_*_record_table" );
463
419
464
420
// when
@@ -510,12 +466,25 @@ public void testGetTableIndexPattern() throws TableNotExistException, DatabaseNo
510
466
assertEquals (expectedSchema , schema );
511
467
}
512
468
469
+ @ Test
470
+ public void testShouldIgnoreNonexistingIndexPattern () {
471
+ // given
472
+ Map <String , String > properties = new HashMap <>();
473
+ properties .put ("properties.index.patterns" , "non_existing_pattern*" );
474
+
475
+ // when
476
+ catalogBuilder ().properties (properties ).build ();
477
+
478
+ // then
479
+ // no exception thrown
480
+ }
481
+
513
482
@ Test
514
483
public void testGetMultipleIndexPatternPartitionedTables () throws TableNotExistException , DatabaseNotExistException {
515
484
// given
516
485
String url = String .format ("jdbc:elasticsearch://%s:%d" , container .getHost (),
517
486
container .getElasticPort ());
518
- Map <String , String > properties = new HashMap <String , String >();
487
+ Map <String , String > properties = new HashMap <>();
519
488
properties .put ("properties.scan.test_*_record*_table.partition.column.name" , "date_col" );
520
489
properties .put ("properties.scan.test_*_record*_table.partition.number" , "10" );
521
490
properties .put ("properties.scan.test_partial_schema_table_*.partition.column.name" , "integer_col" );
0 commit comments