[fix](fe) Fix Ranger Hive unit test initialization on branch-4.1

### What problem does this PR solve?

Related PR: #67414

Problem Summary: The backported Ranger Hive unit test attempts to initialize
lifecycleLock by reflection, but RangerHiveAccessController on branch-4.1 does
not have that field. This makes testPolicyRequestsUseLowerCaseSelect fail
with NoSuchFieldException before exercising row-filter or data-mask requests.
Remove the unsupported lock initialization and its unused imports and throws
clause while preserving both lowercase select assertions.

### Release note

None

### Check List (For Author)

- Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.catalog.authorizer.ranger.hive.RangerHiveAccessControllerTest (2 tests passed); Maven validate (Checkstyle passed).
- Behavior changed: No
- Does this need documentation: No
This commit is contained in:
guoqiang committed 2026-11-04 11:11:38 +08:00
1 parent a43670afba
commit 0129972802
1 file changed
+1 -7
@@ -26,9 +26,6 @@ import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import java.lang.reflect.Field;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class RangerHiveAccessControllerTest {
@Test
public void testRangerAccessTypeMapping() {
@@ -39,12 +36,9 @@ public class RangerHiveAccessControllerTest {
}
@Test
public void testPolicyRequestsUseLowerCaseSelect() throws Exception {
public void testPolicyRequestsUseLowerCaseSelect() {
RangerHiveAccessController controller = Mockito.mock(
RangerHiveAccessController.class, Mockito.CALLS_REAL_METHODS);
Field lifecycleLock = RangerHiveAccessController.class.getDeclaredField("lifecycleLock");
lifecycleLock.setAccessible(true);
lifecycleLock.set(controller, new ReentrantReadWriteLock());
RangerBasePlugin plugin = Mockito.mock(RangerBasePlugin.class);
UserIdentity currentUser = UserIdentity.createAnalyzedUserIdentWithIp("user", "%");
RangerAccessRequestImpl rowFilterRequest = new RangerAccessRequestImpl();