diff --git a/config/spotbugs/exclude.xml b/config/spotbugs/exclude.xml
index 152a1884..5f0e63f5 100644
--- a/config/spotbugs/exclude.xml
+++ b/config/spotbugs/exclude.xml
@@ -27,4 +27,14 @@
+
+
+
+
+
+
diff --git a/hoptimator-api/src/test/java/com/linkedin/hoptimator/PendingDeleteTest.java b/hoptimator-api/src/test/java/com/linkedin/hoptimator/PendingDeleteTest.java
index 99abc023..4a711dae 100644
--- a/hoptimator-api/src/test/java/com/linkedin/hoptimator/PendingDeleteTest.java
+++ b/hoptimator-api/src/test/java/com/linkedin/hoptimator/PendingDeleteTest.java
@@ -2,6 +2,9 @@
import org.junit.jupiter.api.Test;
+import java.util.List;
+import java.util.Map;
+
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -77,7 +80,7 @@ void toStringOmitsSelfOwnerWhenOnlyOneFieldSet() {
@Test
void targetGenericTypeIsPreserved() {
- Source source = new Source("db", java.util.List.of("schema", "tbl"), java.util.Map.of());
+ Source source = new Source("db", List.of("schema", "tbl"), Map.of());
PendingDelete pd = new PendingDelete<>(source);
Source unwrapped = pd.target();
assertEquals("tbl", unwrapped.table());
diff --git a/hoptimator-avro/src/test/java/com/linkedin/hoptimator/avro/AvroTableValidatorTest.java b/hoptimator-avro/src/test/java/com/linkedin/hoptimator/avro/AvroTableValidatorTest.java
index b843bf96..233968e3 100644
--- a/hoptimator-avro/src/test/java/com/linkedin/hoptimator/avro/AvroTableValidatorTest.java
+++ b/hoptimator-avro/src/test/java/com/linkedin/hoptimator/avro/AvroTableValidatorTest.java
@@ -25,6 +25,7 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -90,11 +91,10 @@ protected Map getTableMap() {
CalciteSchema calciteSchema = CalciteSchema.createRootSchema(false, false, "root", innerSchema);
// Mock the SchemaPlus: tables() returns newTable; unwrap returns the CalciteSchema with originalTable
- @SuppressWarnings("unchecked")
- Lookup tableLookup = mock(Lookup.class);
- when(tableLookup.getNames(any())).thenReturn(Set.of("MY_TABLE"));
- when(tableLookup.get("MY_TABLE")).thenReturn(newTable);
- when(schema.tables()).thenReturn(tableLookup);
+ Lookup> tableLookup = mock(Lookup.class);
+ doReturn(Set.of("MY_TABLE")).when(tableLookup).getNames(any());
+ doReturn(newTable).when(tableLookup).get("MY_TABLE");
+ doReturn(tableLookup).when(schema).tables();
when(schema.unwrap(CalciteSchema.class)).thenReturn(calciteSchema);
AvroTableValidator validator = new AvroTableValidator(schema);
@@ -128,11 +128,10 @@ protected Map getTableMap() {
};
CalciteSchema calciteSchema = CalciteSchema.createRootSchema(false, false, "root", innerSchema);
- @SuppressWarnings("unchecked")
- Lookup tableLookup = mock(Lookup.class);
- when(tableLookup.getNames(any())).thenReturn(Set.of("MY_TABLE"));
- when(tableLookup.get("MY_TABLE")).thenReturn(sameTable);
- when(schema.tables()).thenReturn(tableLookup);
+ Lookup> tableLookup = mock(Lookup.class);
+ doReturn(Set.of("MY_TABLE")).when(tableLookup).getNames(any());
+ doReturn(sameTable).when(tableLookup).get("MY_TABLE");
+ doReturn(tableLookup).when(schema).tables();
when(schema.unwrap(CalciteSchema.class)).thenReturn(calciteSchema);
AvroTableValidator validator = new AvroTableValidator(schema);
diff --git a/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDatabaseMetaDataTest.java b/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDatabaseMetaDataTest.java
index bda62b41..e15c50f9 100644
--- a/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDatabaseMetaDataTest.java
+++ b/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDatabaseMetaDataTest.java
@@ -155,7 +155,6 @@ void testGetSchemasWithSchemaPatternFiltersNonMatching() throws SQLException {
}
@Test
- @SuppressWarnings("unchecked")
void testGetSchemasExpandsCatalogWhenSchemaNull() throws SQLException {
ResultSet mockRs = mock(ResultSet.class);
when(mockRs.next()).thenReturn(true, false);
@@ -168,13 +167,13 @@ void testGetSchemasExpandsCatalogWhenSchemaNull() throws SQLException {
when(mockPreparedStatement.executeQuery()).thenReturn(mockRs);
SchemaPlus mockRootSchema = mock(SchemaPlus.class);
- Lookup mockRootSubSchemas = mock(Lookup.class);
+ Lookup> mockRootSubSchemas = mock(Lookup.class);
SchemaPlus mockCatalogSchema = mock(SchemaPlus.class);
- Lookup mockCatalogSubSchemas = mock(Lookup.class);
+ Lookup> mockCatalogSubSchemas = mock(Lookup.class);
when(mockCalciteConnection.getRootSchema()).thenReturn(mockRootSchema);
doReturn(mockRootSubSchemas).when(mockRootSchema).subSchemas();
- when(mockRootSubSchemas.get("myCatalog")).thenReturn(mockCatalogSchema);
+ doReturn(mockCatalogSchema).when(mockRootSubSchemas).get("myCatalog");
doReturn(mockCatalogSubSchemas).when(mockCatalogSchema).subSchemas();
doReturn(Set.of("subSchema1")).when(mockCatalogSubSchemas).getNames(any());
@@ -187,7 +186,6 @@ void testGetSchemasExpandsCatalogWhenSchemaNull() throws SQLException {
}
@Test
- @SuppressWarnings("unchecked")
void testGetSchemasExpandsCatalogWithNullSubSchema() throws SQLException {
ResultSet mockRs = mock(ResultSet.class);
when(mockRs.next()).thenReturn(true, false);
@@ -199,11 +197,11 @@ void testGetSchemasExpandsCatalogWithNullSubSchema() throws SQLException {
when(mockPreparedStatement.executeQuery()).thenReturn(mockRs);
SchemaPlus mockRootSchema = mock(SchemaPlus.class);
- Lookup mockRootSubSchemas = mock(Lookup.class);
+ Lookup> mockRootSubSchemas = mock(Lookup.class);
when(mockCalciteConnection.getRootSchema()).thenReturn(mockRootSchema);
doReturn(mockRootSubSchemas).when(mockRootSchema).subSchemas();
- when(mockRootSubSchemas.get("missingCatalog")).thenReturn(null);
+ doReturn(null).when(mockRootSubSchemas).get("missingCatalog");
ResultSet rs = metaData.getSchemas(null, null);
@@ -265,7 +263,6 @@ void testGetSchemasWithCatalogFiltersSetsParameter() throws SQLException {
}
@Test
- @SuppressWarnings("unchecked")
void testGetTablesReturnsResultSet() throws SQLException {
// Mock getSchemas to return one schema row
ResultSet mockSchemaRs = mock(ResultSet.class);
@@ -281,20 +278,20 @@ void testGetTablesReturnsResultSet() throws SQLException {
SchemaPlus mockRootSchema = mock(SchemaPlus.class);
SchemaPlus mockCatalogSchema = mock(SchemaPlus.class);
SchemaPlus mockDbSchema = mock(SchemaPlus.class);
- Lookup mockRootSubSchemas = mock(Lookup.class);
- Lookup mockCatSubSchemas = mock(Lookup.class);
- Lookup mockTablesLookup = mock(Lookup.class);
+ Lookup> mockRootSubSchemas = mock(Lookup.class);
+ Lookup> mockCatSubSchemas = mock(Lookup.class);
+ Lookup> mockTablesLookup = mock(Lookup.class);
when(mockCalciteConnection.getRootSchema()).thenReturn(mockRootSchema);
doReturn(mockRootSubSchemas).when(mockRootSchema).subSchemas();
- when(mockRootSubSchemas.get("myCat")).thenReturn(mockCatalogSchema);
+ doReturn(mockCatalogSchema).when(mockRootSubSchemas).get("myCat");
doReturn(mockCatSubSchemas).when(mockCatalogSchema).subSchemas();
- when(mockCatSubSchemas.get("mySchema")).thenReturn(mockDbSchema);
+ doReturn(mockDbSchema).when(mockCatSubSchemas).get("mySchema");
doReturn(mockTablesLookup).when(mockDbSchema).tables();
doReturn(Set.of("table1")).when(mockTablesLookup).getNames(any());
Table mockTable = mock(Table.class);
- when(mockTablesLookup.get("table1")).thenReturn(mockTable);
+ doReturn(mockTable).when(mockTablesLookup).get("table1");
when(mockTable.getJdbcTableType()).thenReturn(Schema.TableType.TABLE);
ResultSet rs = metaData.getTables("myCat", "mySchema", null, null);
@@ -308,7 +305,6 @@ void testGetTablesReturnsResultSet() throws SQLException {
}
@Test
- @SuppressWarnings("unchecked")
void testGetTablesWithTypeFilter() throws SQLException {
ResultSet mockSchemaRs = mock(ResultSet.class);
when(mockSchemaRs.next()).thenReturn(true, false);
@@ -322,20 +318,20 @@ void testGetTablesWithTypeFilter() throws SQLException {
SchemaPlus mockRootSchema = mock(SchemaPlus.class);
SchemaPlus mockCatalogSchema = mock(SchemaPlus.class);
SchemaPlus mockDbSchema = mock(SchemaPlus.class);
- Lookup mockRootSub = mock(Lookup.class);
- Lookup mockCatSub = mock(Lookup.class);
- Lookup mockTables = mock(Lookup.class);
+ Lookup> mockRootSub = mock(Lookup.class);
+ Lookup> mockCatSub = mock(Lookup.class);
+ Lookup> mockTables = mock(Lookup.class);
when(mockCalciteConnection.getRootSchema()).thenReturn(mockRootSchema);
doReturn(mockRootSub).when(mockRootSchema).subSchemas();
- when(mockRootSub.get("cat")).thenReturn(mockCatalogSchema);
+ doReturn(mockCatalogSchema).when(mockRootSub).get("cat");
doReturn(mockCatSub).when(mockCatalogSchema).subSchemas();
- when(mockCatSub.get("sch")).thenReturn(mockDbSchema);
+ doReturn(mockDbSchema).when(mockCatSub).get("sch");
doReturn(mockTables).when(mockDbSchema).tables();
doReturn(Set.of("t1")).when(mockTables).getNames(any());
Table mockTable = mock(Table.class);
- when(mockTables.get("t1")).thenReturn(mockTable);
+ doReturn(mockTable).when(mockTables).get("t1");
when(mockTable.getJdbcTableType()).thenReturn(Schema.TableType.VIEW);
// Filter by TABLE type only - should exclude VIEW
@@ -346,7 +342,6 @@ void testGetTablesWithTypeFilter() throws SQLException {
}
@Test
- @SuppressWarnings("unchecked")
void testGetTablesWithMatchingTypeFilter() throws SQLException {
ResultSet mockSchemaRs = mock(ResultSet.class);
when(mockSchemaRs.next()).thenReturn(true, false);
@@ -360,20 +355,20 @@ void testGetTablesWithMatchingTypeFilter() throws SQLException {
SchemaPlus mockRootSchema = mock(SchemaPlus.class);
SchemaPlus mockCatalogSchema = mock(SchemaPlus.class);
SchemaPlus mockDbSchema = mock(SchemaPlus.class);
- Lookup mockRootSub = mock(Lookup.class);
- Lookup mockCatSub = mock(Lookup.class);
- Lookup mockTables = mock(Lookup.class);
+ Lookup> mockRootSub = mock(Lookup.class);
+ Lookup> mockCatSub = mock(Lookup.class);
+ Lookup> mockTables = mock(Lookup.class);
when(mockCalciteConnection.getRootSchema()).thenReturn(mockRootSchema);
doReturn(mockRootSub).when(mockRootSchema).subSchemas();
- when(mockRootSub.get("cat")).thenReturn(mockCatalogSchema);
+ doReturn(mockCatalogSchema).when(mockRootSub).get("cat");
doReturn(mockCatSub).when(mockCatalogSchema).subSchemas();
- when(mockCatSub.get("sch")).thenReturn(mockDbSchema);
+ doReturn(mockDbSchema).when(mockCatSub).get("sch");
doReturn(mockTables).when(mockDbSchema).tables();
doReturn(Set.of("t1")).when(mockTables).getNames(any());
Table mockTable = mock(Table.class);
- when(mockTables.get("t1")).thenReturn(mockTable);
+ doReturn(mockTable).when(mockTables).get("t1");
when(mockTable.getJdbcTableType()).thenReturn(Schema.TableType.TABLE);
// Filter by TABLE type - should include
@@ -447,7 +442,6 @@ void testGetSchemasWithWildcardPatternMatchesAll() throws SQLException {
}
@Test
- @SuppressWarnings("unchecked")
void testGetTablesWithViewTypeFilterIncludesViewExcludesTable() throws SQLException {
// Tests that types=["VIEW"] only returns view tables
ResultSet mockSchemaRs = mock(ResultSet.class);
@@ -462,20 +456,20 @@ void testGetTablesWithViewTypeFilterIncludesViewExcludesTable() throws SQLExcept
SchemaPlus mockRootSchema = mock(SchemaPlus.class);
SchemaPlus mockCatalogSchema = mock(SchemaPlus.class);
SchemaPlus mockDbSchema = mock(SchemaPlus.class);
- Lookup mockRootSub = mock(Lookup.class);
- Lookup mockCatSub = mock(Lookup.class);
- Lookup mockTables = mock(Lookup.class);
+ Lookup> mockRootSub = mock(Lookup.class);
+ Lookup> mockCatSub = mock(Lookup.class);
+ Lookup> mockTables = mock(Lookup.class);
when(mockCalciteConnection.getRootSchema()).thenReturn(mockRootSchema);
doReturn(mockRootSub).when(mockRootSchema).subSchemas();
- when(mockRootSub.get("cat")).thenReturn(mockCatalogSchema);
+ doReturn(mockCatalogSchema).when(mockRootSub).get("cat");
doReturn(mockCatSub).when(mockCatalogSchema).subSchemas();
- when(mockCatSub.get("sch")).thenReturn(mockDbSchema);
+ doReturn(mockDbSchema).when(mockCatSub).get("sch");
doReturn(mockTables).when(mockDbSchema).tables();
doReturn(Set.of("v1")).when(mockTables).getNames(any());
Table mockView = mock(Table.class);
- when(mockTables.get("v1")).thenReturn(mockView);
+ doReturn(mockView).when(mockTables).get("v1");
when(mockView.getJdbcTableType()).thenReturn(Schema.TableType.VIEW);
// Filter by VIEW — should include the view
@@ -489,7 +483,6 @@ void testGetTablesWithViewTypeFilterIncludesViewExcludesTable() throws SQLExcept
}
@Test
- @SuppressWarnings("unchecked")
void testGetTablesSchemaPatternFiltersNonMatchingSchemas() throws SQLException {
// Tests that non-matching schemaPattern yields empty result
ResultSet mockSchemaRs = mock(ResultSet.class);
@@ -506,7 +499,6 @@ void testGetTablesSchemaPatternFiltersNonMatchingSchemas() throws SQLException {
}
@Test
- @SuppressWarnings("unchecked")
void testGetTablesWithNullTypesIncludesBothTablesAndViews() throws SQLException {
// types=null means all types — tests the `types != null && types.length > 0` condition
ResultSet mockSchemaRs = mock(ResultSet.class);
@@ -521,20 +513,20 @@ void testGetTablesWithNullTypesIncludesBothTablesAndViews() throws SQLException
SchemaPlus mockRootSchema = mock(SchemaPlus.class);
SchemaPlus mockCatalogSchema = mock(SchemaPlus.class);
SchemaPlus mockDbSchema = mock(SchemaPlus.class);
- Lookup mockRootSub = mock(Lookup.class);
- Lookup mockCatSub = mock(Lookup.class);
- Lookup mockTables = mock(Lookup.class);
+ Lookup> mockRootSub = mock(Lookup.class);
+ Lookup> mockCatSub = mock(Lookup.class);
+ Lookup> mockTables = mock(Lookup.class);
when(mockCalciteConnection.getRootSchema()).thenReturn(mockRootSchema);
doReturn(mockRootSub).when(mockRootSchema).subSchemas();
- when(mockRootSub.get("cat")).thenReturn(mockCatalogSchema);
+ doReturn(mockCatalogSchema).when(mockRootSub).get("cat");
doReturn(mockCatSub).when(mockCatalogSchema).subSchemas();
- when(mockCatSub.get("sch")).thenReturn(mockDbSchema);
+ doReturn(mockDbSchema).when(mockCatSub).get("sch");
doReturn(mockTables).when(mockDbSchema).tables();
doReturn(Set.of("t1")).when(mockTables).getNames(any());
Table mockTable = mock(Table.class);
- when(mockTables.get("t1")).thenReturn(mockTable);
+ doReturn(mockTable).when(mockTables).get("t1");
when(mockTable.getJdbcTableType()).thenReturn(Schema.TableType.VIEW);
// types=null — VIEW should still be included
diff --git a/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDdlUtilsTest.java b/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDdlUtilsTest.java
index 29a11973..703bf656 100644
--- a/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDdlUtilsTest.java
+++ b/hoptimator-jdbc/src/test/java/com/linkedin/hoptimator/jdbc/HoptimatorDdlUtilsTest.java
@@ -1,5 +1,6 @@
package com.linkedin.hoptimator.jdbc;
+import com.linkedin.hoptimator.Database;
import com.linkedin.hoptimator.Deployer;
import com.linkedin.hoptimator.Job;
import com.linkedin.hoptimator.Pipeline;
@@ -9,6 +10,7 @@
import com.linkedin.hoptimator.jdbc.ddl.SqlCreateDatabase;
import com.linkedin.hoptimator.jdbc.ddl.SqlCreateMaterializedView;
import com.linkedin.hoptimator.jdbc.ddl.SqlCreateTable;
+import com.linkedin.hoptimator.util.planner.HoptimatorJdbcTable;
import com.linkedin.hoptimator.util.planner.PipelineRel;
import org.apache.calcite.jdbc.CalcitePrepare;
import org.apache.calcite.jdbc.CalciteSchema;
@@ -1189,8 +1191,7 @@ void processCreateMaterializedViewThrowsWhenOverwritingHoptimatorJdbcTable() thr
.add("TEST_JDBC_DB", new TestDatabaseSchema("test-jdbc-db"));
// Create a mock HoptimatorJdbcTable and register it
- com.linkedin.hoptimator.util.planner.HoptimatorJdbcTable jdbcTable =
- mock(com.linkedin.hoptimator.util.planner.HoptimatorJdbcTable.class);
+ HoptimatorJdbcTable jdbcTable = mock(HoptimatorJdbcTable.class);
jdbcDbSchema.add("physicalTable", jdbcTable);
// replace=false, ifNotExists=false, but we're trying to overwrite a HoptimatorJdbcTable
@@ -1592,8 +1593,7 @@ void specifyFromSqlForCreateDatabaseReturnsEmptySpecsWhenNoDeployersRegistered()
}
}
- static class TestDatabaseSchema extends AbstractSchema
- implements com.linkedin.hoptimator.Database {
+ static class TestDatabaseSchema extends AbstractSchema implements Database {
private final String name;
TestDatabaseSchema(String name) {
@@ -1628,7 +1628,7 @@ void removeTableFromSchemaRemovesFromRootWhenNoSchema() throws SQLException {
HoptimatorDdlUtils.removeTableFromSchema(connection, null, null, "ROOT_TMP");
- assertEquals(null, rootSchema.tables().get("ROOT_TMP"));
+ assertNull(rootSchema.tables().get("ROOT_TMP"));
}
}
@@ -1649,7 +1649,7 @@ void removeTableFromSchemaRemovesFromTierSchema() throws SQLException {
HoptimatorDdlUtils.removeTableFromSchema(connection, null, "KAFKA", "my_topic");
- assertEquals(null, tierSchema.tables().get("my_topic"));
+ assertNull(tierSchema.tables().get("my_topic"));
}
}
@@ -1669,7 +1669,7 @@ void removeTableFromSchemaRemovesFromCatalogAndSchema() throws SQLException {
HoptimatorDdlUtils.removeTableFromSchema(connection, "CAT", "DB", "t");
- assertEquals(null, dbSchema.tables().get("t"));
+ assertNull(dbSchema.tables().get("t"));
}
}
diff --git a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sApiErrorResponseTest.java b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sApiErrorResponseTest.java
index ff9cd7f9..117e0d88 100644
--- a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sApiErrorResponseTest.java
+++ b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sApiErrorResponseTest.java
@@ -16,6 +16,7 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -78,16 +79,15 @@ void deleteThrowsWhenResponseIsErrorStatus() throws ApiException {
}
@Test
- @SuppressWarnings("unchecked")
void updateThrowsWhenResponseIsErrorStatusOnFinalUpdate() throws ApiException {
V1alpha1Pipeline pipeline = makePipeline("bad-pipeline", "test-ns");
V1alpha1Pipeline existing = makePipeline("bad-pipeline", "test-ns");
existing.getMetadata().setResourceVersion("rv1");
- KubernetesApiResponse existingResp = mock(KubernetesApiResponse.class);
+ KubernetesApiResponse> existingResp = mock(KubernetesApiResponse.class);
when(existingResp.isSuccess()).thenReturn(true);
- when(existingResp.getObject()).thenReturn(existing);
- when(mockErrApi.get(eq("test-ns"), eq("bad-pipeline"))).thenReturn(existingResp);
+ doReturn(existing).when(existingResp).getObject();
+ doReturn(existingResp).when(mockErrApi).get(eq("test-ns"), eq("bad-pipeline"));
ApiException apiEx = new ApiException(500, "Internal Server Error");
when(mockErrApi.update(any(V1alpha1Pipeline.class))).thenReturn(mockErrResponse);
diff --git a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sConnectorTest.java b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sConnectorTest.java
index 422bf7b7..82e89239 100644
--- a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sConnectorTest.java
+++ b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sConnectorTest.java
@@ -18,6 +18,7 @@
import org.apache.calcite.rel.type.RelDataTypeSystem;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.calcite.schema.Table;
+import org.apache.calcite.schema.impl.AbstractSchema;
import org.apache.calcite.schema.impl.AbstractTable;
import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
import org.apache.calcite.sql.type.SqlTypeName;
@@ -422,7 +423,7 @@ private void installRootSchemaWithTable(Source source, Table table) {
SchemaPlus root = CalciteSchema.createRootSchema(false).plus();
SchemaPlus parent = root;
for (String part : source.path().subList(0, source.path().size() - 1)) {
- parent = parent.add(part, new org.apache.calcite.schema.impl.AbstractSchema());
+ parent = parent.add(part, new AbstractSchema());
}
parent.add(source.table(), table);
diff --git a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sContextTest.java b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sContextTest.java
index 1a8970ef..4082b436 100644
--- a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sContextTest.java
+++ b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sContextTest.java
@@ -1,6 +1,7 @@
package com.linkedin.hoptimator.k8s;
import com.linkedin.hoptimator.jdbc.HoptimatorConnection;
+import com.linkedin.hoptimator.k8s.models.V1alpha1View;
import io.kubernetes.client.informer.SharedInformerFactory;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
@@ -172,7 +173,7 @@ void ownWithNonDynamicKubernetesObject() {
K8sContext owned = context.withOwner(owner);
// Use a non-DynamicKubernetesObject (V1alpha1View)
- com.linkedin.hoptimator.k8s.models.V1alpha1View view = new com.linkedin.hoptimator.k8s.models.V1alpha1View();
+ V1alpha1View view = new V1alpha1View();
view.setMetadata(new V1ObjectMeta().name("test-view").namespace("ns"));
owned.own(view);
@@ -188,7 +189,7 @@ void ownNonDynamicObjectDoesNotDuplicate() {
.kind("View").apiVersion("hoptimator.linkedin.com/v1alpha1");
K8sContext owned = context.withOwner(owner);
- com.linkedin.hoptimator.k8s.models.V1alpha1View view = new com.linkedin.hoptimator.k8s.models.V1alpha1View();
+ V1alpha1View view = new V1alpha1View();
List existing = new ArrayList<>();
existing.add(new V1OwnerReference().name("owner").uid("uid-789"));
view.setMetadata(new V1ObjectMeta().name("test-view").namespace("ns").ownerReferences(existing));
diff --git a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sDatabaseTableTest.java b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sDatabaseTableTest.java
index 5a12c1d5..fd2d14b0 100644
--- a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sDatabaseTableTest.java
+++ b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sDatabaseTableTest.java
@@ -274,7 +274,6 @@ void addDatabasesWithNoCatalog() throws Exception {
assertNotNull(root.subSchemas().get("TESTSCH"));
}
- @SuppressWarnings("unchecked")
@Test
void addDatabasesWithCatalog() throws Exception {
List databases = new ArrayList<>();
diff --git a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sValidatorProviderTest.java b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sValidatorProviderTest.java
index 52372e6b..0b4efdfc 100644
--- a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sValidatorProviderTest.java
+++ b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sValidatorProviderTest.java
@@ -2,6 +2,7 @@
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
@@ -18,7 +19,7 @@
class K8sValidatorProviderTest {
private static Source testSource() {
- return new Source("kafka1", java.util.List.of("KAFKA", "my-topic"), Map.of());
+ return new Source("kafka1", List.of("KAFKA", "my-topic"), Map.of());
}
@Test
diff --git a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sYamlApiTest.java b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sYamlApiTest.java
index d640d7da..c903269a 100644
--- a/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sYamlApiTest.java
+++ b/hoptimator-k8s/src/test/java/com/linkedin/hoptimator/k8s/K8sYamlApiTest.java
@@ -90,18 +90,16 @@ class RealMethodTests {
@Mock
private K8sContext mockContext;
- @SuppressWarnings("unchecked")
- private KubernetesApiResponse successResponse(DynamicKubernetesObject obj) {
- KubernetesApiResponse resp = mock(KubernetesApiResponse.class);
+ private KubernetesApiResponse> successResponse(DynamicKubernetesObject obj) {
+ KubernetesApiResponse> resp = mock(KubernetesApiResponse.class);
lenient().when(resp.isSuccess()).thenReturn(true);
lenient().when(resp.getHttpStatusCode()).thenReturn(200);
- lenient().when(resp.getObject()).thenReturn(obj);
+ lenient().doReturn(obj).when(resp).getObject();
return resp;
}
- @SuppressWarnings("unchecked")
- private KubernetesApiResponse notFoundResponse() {
- KubernetesApiResponse resp = mock(KubernetesApiResponse.class);
+ private KubernetesApiResponse> notFoundResponse() {
+ KubernetesApiResponse> resp = mock(KubernetesApiResponse.class);
lenient().when(resp.isSuccess()).thenReturn(false);
lenient().when(resp.getHttpStatusCode()).thenReturn(404);
return resp;
@@ -421,12 +419,11 @@ class CreateWithMetadataSideEffectTests {
@Mock
private K8sContext mockContext;
- @SuppressWarnings("unchecked")
- private KubernetesApiResponse successResponse(DynamicKubernetesObject obj) {
- KubernetesApiResponse resp = mock(KubernetesApiResponse.class);
+ private KubernetesApiResponse> successResponse(DynamicKubernetesObject obj) {
+ KubernetesApiResponse> resp = mock(KubernetesApiResponse.class);
lenient().when(resp.isSuccess()).thenReturn(true);
lenient().when(resp.getHttpStatusCode()).thenReturn(200);
- lenient().when(resp.getObject()).thenReturn(obj);
+ lenient().doReturn(obj).when(resp).getObject();
return resp;
}
@@ -616,18 +613,16 @@ class UpdateSideEffectTests {
@Mock
private K8sContext mockContext;
- @SuppressWarnings("unchecked")
- private KubernetesApiResponse successResponse(DynamicKubernetesObject obj) {
- KubernetesApiResponse resp = mock(KubernetesApiResponse.class);
+ private KubernetesApiResponse> successResponse(DynamicKubernetesObject obj) {
+ KubernetesApiResponse> resp = mock(KubernetesApiResponse.class);
lenient().when(resp.isSuccess()).thenReturn(true);
lenient().when(resp.getHttpStatusCode()).thenReturn(200);
- lenient().when(resp.getObject()).thenReturn(obj);
+ lenient().doReturn(obj).when(resp).getObject();
return resp;
}
- @SuppressWarnings("unchecked")
- private KubernetesApiResponse notFoundResponse() {
- KubernetesApiResponse resp = mock(KubernetesApiResponse.class);
+ private KubernetesApiResponse> notFoundResponse() {
+ KubernetesApiResponse> resp = mock(KubernetesApiResponse.class);
lenient().when(resp.isSuccess()).thenReturn(false);
lenient().when(resp.getHttpStatusCode()).thenReturn(404);
return resp;
@@ -771,8 +766,7 @@ void getIfExistsReturnsObjectFor200AndNotNullFor200Status() throws SQLException
@Test
void getIfExistsThrowsForNon404ErrorResponse() throws ApiException, SQLException {
- @SuppressWarnings("unchecked")
- KubernetesApiResponse errorResp = mock(KubernetesApiResponse.class);
+ KubernetesApiResponse> errorResp = mock(KubernetesApiResponse.class);
lenient().when(errorResp.isSuccess()).thenReturn(false);
lenient().when(errorResp.getHttpStatusCode()).thenReturn(500);
ApiException apiEx = new ApiException(500, "Server Error");
diff --git a/hoptimator-kafka-controller/src/test/java/com/linkedin/hoptimator/operator/kafka/KafkaTopicReconcilerTest.java b/hoptimator-kafka-controller/src/test/java/com/linkedin/hoptimator/operator/kafka/KafkaTopicReconcilerTest.java
index 9c04a676..0fbcb8ff 100644
--- a/hoptimator-kafka-controller/src/test/java/com/linkedin/hoptimator/operator/kafka/KafkaTopicReconcilerTest.java
+++ b/hoptimator-kafka-controller/src/test/java/com/linkedin/hoptimator/operator/kafka/KafkaTopicReconcilerTest.java
@@ -37,6 +37,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyCollection;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -85,7 +86,6 @@ void testReconcileNonDeletedSqlExceptionRequeues() throws Exception {
assertTrue(result.isRequeue());
}
- @SuppressWarnings("unchecked")
@Test
void testReconcileCreatesNewTopic() throws Exception {
V1alpha1KafkaTopic topic = buildKafkaTopic("my-topic", 5, 3);
@@ -93,9 +93,9 @@ void testReconcileCreatesNewTopic() throws Exception {
// Admin describe throws UnknownTopicOrPartitionException (topic doesn't exist yet)
DescribeTopicsResult describeResult = mock(DescribeTopicsResult.class);
- KafkaFuture