JoegenUSTC commented on code in PR #11355:
URL: https://github.com/apache/gravitino/pull/11355#discussion_r3353879004


##########
catalogs/hive-metastore-common/src/test/java/org/apache/gravitino/hive/client/TestHiveClientFactoryClassLoader.java:
##########
@@ -0,0 +1,208 @@
+/*
+ * 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.hive.client;
+
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Properties;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Unit tests for ClassLoader-related fixes in {@link HiveClientFactory}.
+ *
+ * <p>These tests verify the three bug fixes without requiring a live HMS or 
KDC:
+ *
+ * <ul>
+ *   <li>Bug 1: {@code createHiveClientWithBackend()} uses a stable {@code 
baseLoader} ( {@code
+ *       HiveClientFactory.class.getClassLoader()}) instead of the unstable 
TCCL.
+ *   <li>Bug 2: {@code createHiveClientImpl()} loads {@code HiveVersion} from 
the isolated
+ *       ClassLoader to avoid {@link NoSuchMethodException}.
+ * </ul>
+ *
+ * <p>Bug 3 (missing {@code doAs} in non-impersonation Kerberos path) requires 
a live KDC and is
+ * covered by the integration test {@link 
TestHive2HMSWithKerberosNoImpersonation}.
+ */
+public class TestHiveClientFactoryClassLoader {
+
+  // 
---------------------------------------------------------------------------
+  // Bug 1: factory CL is stable; TCCL is not — contrast/rationale tests
+  // 
---------------------------------------------------------------------------

Review Comment:
   Agreed, removed.
   
   `testFactoryClassLoaderIsStableAcrossThreads` and 
`testTCCLIsUnstableAcrossThreads` were 
   testing Java language guarantees (a class's ClassLoader never changes; TCCL 
can be set per 
   thread) rather than any behaviour specific to our code. They don't add 
regression value 
   and have been deleted.



-- 
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]

Reply via email to