Skip to content

Commit b31ca56

Browse files
committed
fixing spotless checks + tests
1 parent cfeafc8 commit b31ca56

File tree

4 files changed

+59
-8
lines changed

4 files changed

+59
-8
lines changed

fluss-flink/fluss-flink-2.2/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalog22Test.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,46 @@ protected ResolvedSchema createSchema() {
5959
DefaultIndex.newIndex(
6060
"INDEX_first_third", Arrays.asList("first", "third"))));
6161
}
62+
63+
@Override
64+
protected org.apache.flink.table.catalog.CatalogMaterializedTable newCatalogMaterializedTable(
65+
ResolvedSchema resolvedSchema,
66+
org.apache.flink.table.catalog.CatalogMaterializedTable.RefreshMode refreshMode,
67+
java.util.Map<String, String> options) {
68+
org.apache.flink.table.catalog.CatalogMaterializedTable origin =
69+
org.apache.flink.table.catalog.CatalogMaterializedTable.newBuilder()
70+
.schema(
71+
org.apache.flink.table.api.Schema.newBuilder()
72+
.fromResolvedSchema(resolvedSchema)
73+
.build())
74+
.comment("test comment")
75+
.options(options)
76+
.partitionKeys(Collections.emptyList())
77+
.definitionQuery("select first, second, third from t")
78+
.freshness(
79+
org.apache.flink.table.catalog.IntervalFreshness.of(
80+
"5",
81+
org.apache.flink.table.catalog.IntervalFreshness.TimeUnit
82+
.SECOND))
83+
.logicalRefreshMode(
84+
refreshMode
85+
== org.apache.flink.table.catalog
86+
.CatalogMaterializedTable.RefreshMode
87+
.CONTINUOUS
88+
? org.apache.flink.table.catalog.CatalogMaterializedTable
89+
.LogicalRefreshMode.CONTINUOUS
90+
: org.apache.flink.table.catalog.CatalogMaterializedTable
91+
.LogicalRefreshMode.FULL)
92+
.refreshMode(refreshMode)
93+
.refreshStatus(
94+
org.apache.flink.table.catalog.CatalogMaterializedTable
95+
.RefreshStatus.INITIALIZING)
96+
.build();
97+
return new org.apache.flink.table.catalog.ResolvedCatalogMaterializedTable(
98+
origin,
99+
resolvedSchema,
100+
refreshMode,
101+
org.apache.flink.table.catalog.IntervalFreshness.of(
102+
"5", org.apache.flink.table.catalog.IntervalFreshness.TimeUnit.SECOND));
103+
}
62104
}

fluss-flink/fluss-flink-2.2/src/test/java/org/apache/fluss/flink/sink/Flink22ComplexTypeITCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717

1818
package org.apache.fluss.flink.sink;
1919

20-
/** Integration tests for Array type support in Flink 2.1. */
20+
/** Integration tests for Array type support in Flink 2.2. */
2121
public class Flink22ComplexTypeITCase extends FlinkComplexTypeITCase {}

fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalogTest.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private CatalogTable newCatalogTable(
139139
return new ResolvedCatalogTable(origin, resolvedSchema);
140140
}
141141

142-
private CatalogMaterializedTable newCatalogMaterializedTable(
142+
protected CatalogMaterializedTable newCatalogMaterializedTable(
143143
ResolvedSchema resolvedSchema,
144144
CatalogMaterializedTable.RefreshMode refreshMode,
145145
Map<String, String> options) {
@@ -306,7 +306,8 @@ void testCreateTable() throws Exception {
306306
assertThatThrownBy(() -> catalog.renameTable(this.tableInDefaultDb, "newName", false))
307307
.isInstanceOf(UnsupportedOperationException.class);
308308

309-
// Test lake table handling - should throw TableNotExistException for non-existent lake
309+
// Test lake table handling - should throw TableNotExistException for
310+
// non-existent lake
310311
// table
311312
ObjectPath lakePath = new ObjectPath(DEFAULT_DB, "regularTable$lake");
312313
assertThatThrownBy(() -> catalog.getTable(lakePath))
@@ -332,7 +333,8 @@ void testCreateAlreadyExistsLakeTable() throws Exception {
332333
// drop fluss table
333334
catalog.dropTable(lakeTablePath, false);
334335
assertThat(catalog.tableExists(lakeTablePath)).isFalse();
335-
// create the table again should be ok, because the existing lake table is matched
336+
// create the table again should be ok, because the existing lake table is
337+
// matched
336338
catalog.createTable(lakeTablePath, table, false);
337339
}
338340

@@ -547,7 +549,8 @@ void testCreateUnsupportedMaterializedTable() {
547549
this.createSchema(),
548550
CatalogMaterializedTable.RefreshMode.FULL,
549551
Collections.emptyMap());
550-
// Fluss doesn't support insert overwrite in batch mode now, so full refresh mode is not
552+
// Fluss doesn't support insert overwrite in batch mode now, so full refresh
553+
// mode is not
551554
// supported now.
552555
assertThatThrownBy(
553556
() ->
@@ -615,7 +618,8 @@ void testDatabase() throws Exception {
615618
.hasMessage("Database %s in catalog %s is not empty.", "db1", CATALOG_NAME);
616619
// should be ok since we set cascade = true
617620
catalog.dropDatabase("db1", false, true);
618-
// drop it again, should throw exception since db1 is not exist and we set ignoreIfNotExists
621+
// drop it again, should throw exception since db1 is not exist and we set
622+
// ignoreIfNotExists
619623
// = false
620624
assertThatThrownBy(() -> catalog.dropDatabase("db1", false, true))
621625
.isInstanceOf(DatabaseNotExistException.class)
@@ -627,7 +631,8 @@ void testDatabase() throws Exception {
627631
catalog.dropDatabase("db2", false, true);
628632
// should be empty
629633
assertThat(catalog.listDatabases()).isEqualTo(Collections.singletonList(DEFAULT_DB));
630-
// should throw exception since the db is not exist and we set ignoreIfNotExists = false
634+
// should throw exception since the db is not exist and we set ignoreIfNotExists
635+
// = false
631636
assertThatThrownBy(() -> catalog.listTables("unknown"))
632637
.isInstanceOf(DatabaseNotExistException.class)
633638
.hasMessage("Database %s does not exist in Catalog %s.", "unknown", CATALOG_NAME);
@@ -846,7 +851,7 @@ void testConnectionFailureHandling() {
846851

847852
@Test
848853
void testStatisticsOperations() throws Exception {
849-
// Statistics testing
854+
// Statistics testing
850855
CatalogTable table = newCatalogTable(Collections.emptyMap());
851856
ObjectPath tablePath = new ObjectPath(DEFAULT_DB, "statsTable");
852857
catalog.createTable(tablePath, table, false);

fluss-test-coverage/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@
166166
<exclude>fluss-test-utils/**</exclude>
167167
<!-- exclude adapter classes to avoid Jacoco error: "Can't add different class with same name" -->
168168
<exclude>fluss-flink/**/target/classes/org/apache/fluss/flink/adapter/**</exclude>
169+
<!-- exclude FlinkSink from flink 2.2 to avoid Jacoco duplicate class error -->
170+
<exclude>fluss-flink/fluss-flink-2.2/target/classes/org/apache/fluss/flink/sink/FlinkSink*</exclude>
169171
</excludes>
170172
</resource>
171173
</resources>
@@ -208,6 +210,8 @@
208210
<exclude>fluss-test-utils/**</exclude>
209211
<!-- exclude adapter classes to avoid Jacoco error: "Can't add different class with same name" -->
210212
<exclude>fluss-flink/**/target/classes/org/apache/fluss/flink/adapter/**</exclude>
213+
<!-- exclude FlinkSink from flink 2.2 to avoid Jacoco duplicate class error -->
214+
<exclude>fluss-flink/fluss-flink-2.2/target/classes/org/apache/fluss/flink/sink/FlinkSink*</exclude>
211215
</excludes>
212216
</resource>
213217
</resources>

0 commit comments

Comments
 (0)