Copilot commented on code in PR #9191: URL: https://github.com/apache/gravitino/pull/9191#discussion_r2558841976
########## flink-connector/flink/src/test/java/org/apache/gravitino/flink/connector/integration/test/catalog/GravitinoCatalogManagerIT.java: ########## @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.gravitino.flink.connector.integration.test.catalog; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Collections; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.table.api.EnvironmentSettings; +import org.apache.flink.table.api.TableEnvironment; +import org.apache.flink.table.api.internal.TableEnvironmentImpl; +import org.apache.flink.table.gateway.SqlGateway; +import org.apache.flink.table.gateway.service.context.DefaultContext; +import org.apache.flink.table.gateway.service.session.SessionManager; +import org.apache.gravitino.client.GravitinoMetalake; +import org.apache.gravitino.flink.connector.store.GravitinoCatalogStoreFactoryOptions; +import org.apache.gravitino.integration.test.util.BaseIT; +import org.apache.gravitino.rest.RESTUtils; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GravitinoCatalogManagerIT extends BaseIT { + + private static final Logger LOG = LoggerFactory.getLogger(GravitinoCatalogManagerIT.class); + + protected static final String GRAVITINO_METALAKE = "flink"; + + protected static GravitinoMetalake metalake; + + protected static TableEnvironment tableEnv; + + protected static SqlGateway sqlGateway; + + protected static String warehouse; + Review Comment: The `warehouse` field is declared but never used in this test class. Consider removing it to improve code clarity. ```suggestion ``` ########## flink-connector/flink/src/test/java/org/apache/gravitino/flink/connector/integration/test/catalog/GravitinoCatalogManagerIT.java: ########## @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.gravitino.flink.connector.integration.test.catalog; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Collections; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.table.api.EnvironmentSettings; +import org.apache.flink.table.api.TableEnvironment; +import org.apache.flink.table.api.internal.TableEnvironmentImpl; +import org.apache.flink.table.gateway.SqlGateway; +import org.apache.flink.table.gateway.service.context.DefaultContext; +import org.apache.flink.table.gateway.service.session.SessionManager; +import org.apache.gravitino.client.GravitinoMetalake; +import org.apache.gravitino.flink.connector.store.GravitinoCatalogStoreFactoryOptions; +import org.apache.gravitino.integration.test.util.BaseIT; +import org.apache.gravitino.rest.RESTUtils; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GravitinoCatalogManagerIT extends BaseIT { + + private static final Logger LOG = LoggerFactory.getLogger(GravitinoCatalogManagerIT.class); + + protected static final String GRAVITINO_METALAKE = "flink"; + + protected static GravitinoMetalake metalake; + + protected static TableEnvironment tableEnv; + + protected static SqlGateway sqlGateway; + + protected static String warehouse; + + private static String gravitinoUri = "http://127.0.0.1:8090"; + + private static String sqlGatewayHost = "localhost"; + + private static int sqlGatewayPort; + + private static String sqlGatewayRestUri; + + @BeforeAll + void startUp() throws Exception { + // Start Gravitino server + super.startIntegrationTest(); + initGravitinoEnv(); + initMetalake(); + initFlinkEnv(); + LOG.info("Startup Flink env successfully, Gravitino uri: {}.", gravitinoUri); + } + + @AfterAll + void stop() throws Exception { + stopFlinkEnv(); + super.stopIntegrationTest(); Review Comment: The `@AfterAll` method should be static in JUnit 5. Non-static lifecycle methods are only supported with `@TestInstance(Lifecycle.PER_CLASS)`. Without this annotation, the test may fail or behave unexpectedly. Either make this method static or add `@TestInstance(TestInstance.Lifecycle.PER_CLASS)` to the class. ```suggestion static void stop() throws Exception { stopFlinkEnv(); BaseIT.stopIntegrationTest(); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
