|
3 | 3 | */
|
4 | 4 | package com.getindata.connectors.http.internal.table.lookup.querycreators;
|
5 | 5 |
|
| 6 | +import java.util.Collections; |
6 | 7 | import java.util.List;
|
7 | 8 |
|
8 | 9 | import org.apache.flink.configuration.Configuration;
|
9 | 10 | import org.apache.flink.table.api.DataTypes;
|
| 11 | +import org.apache.flink.table.api.Schema; |
10 | 12 | import org.apache.flink.table.catalog.*;
|
11 | 13 | import org.apache.flink.table.data.GenericRowData;
|
12 | 14 | import org.apache.flink.table.data.RowData;
|
13 | 15 | import org.apache.flink.table.data.StringData;
|
14 | 16 | import org.apache.flink.table.factories.DynamicTableFactory;
|
| 17 | +import org.apache.flink.table.factories.FactoryUtil; |
15 | 18 | import org.junit.jupiter.api.BeforeEach;
|
16 | 19 | import org.junit.jupiter.api.Test;
|
17 | 20 | import static org.assertj.core.api.Assertions.assertThat;
|
|
24 | 27 | import com.getindata.connectors.http.internal.table.lookup.RowDataSingleValueLookupSchemaEntry;
|
25 | 28 | import static com.getindata.connectors.http.internal.table.lookup.HttpLookupTableSourceFactory.row;
|
26 | 29 | import static com.getindata.connectors.http.internal.table.lookup.querycreators.GenericJsonAndUrlQueryCreatorFactory.*;
|
27 |
| -import static com.getindata.connectors.http.internal.table.lookup.querycreators.QueryCreatorUtils.getTableContext; |
28 | 30 |
|
29 | 31 | class GenericJsonAndUrlQueryCreatorFactoryTest
|
30 | 32 | {
|
@@ -114,4 +116,21 @@ void optionsTests() {
|
114 | 116 | assertThat(factory.optionalOptions()).contains(REQUEST_BODY_FIELDS);
|
115 | 117 | assertThat(factory.optionalOptions()).contains(REQUEST_URL_MAP);
|
116 | 118 | }
|
| 119 | + public static DynamicTableFactory.Context getTableContext(Configuration config, |
| 120 | + ResolvedSchema resolvedSchema) { |
| 121 | + return new FactoryUtil.DefaultDynamicTableContext( |
| 122 | + ObjectIdentifier.of("default", "default", "test"), |
| 123 | + new ResolvedCatalogTable( |
| 124 | + CatalogTable.of( |
| 125 | + Schema.newBuilder().fromResolvedSchema(resolvedSchema).build(), |
| 126 | + null, |
| 127 | + Collections.emptyList(), |
| 128 | + Collections.emptyMap()), |
| 129 | + resolvedSchema), |
| 130 | + Collections.emptyMap(), |
| 131 | + config, |
| 132 | + Thread.currentThread().getContextClassLoader(), |
| 133 | + false |
| 134 | + ); |
| 135 | + } |
117 | 136 | }
|
0 commit comments