Skip to content

Commit 3979067

Browse files
RANGER-5560: mockito upgrade to 5
1 parent 3c5f2d9 commit 3979067

35 files changed

Lines changed: 629 additions & 658 deletions

agents-common/pom.xml

Lines changed: 42 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,32 @@
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3232
</properties>
3333
<dependencies>
34+
<dependency>
35+
<groupId>com.fasterxml.jackson.core</groupId>
36+
<artifactId>jackson-core</artifactId>
37+
<version>${fasterxml.jackson.version}</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.fasterxml.jackson.core</groupId>
41+
<artifactId>jackson-databind</artifactId>
42+
<version>${fasterxml.jackson.databind.version}</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
46+
<artifactId>jackson-jaxrs-base</artifactId>
47+
<version>${fasterxml.jackson.version}</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
51+
<artifactId>jackson-jaxrs-json-provider</artifactId>
52+
<version>${fasterxml.jackson.version}</version>
53+
<exclusions>
54+
<exclusion>
55+
<groupId>jakarta.activation</groupId>
56+
<artifactId>jakarta.activation-api</artifactId>
57+
</exclusion>
58+
</exclusions>
59+
</dependency>
3460
<dependency>
3561
<groupId>com.google.code.findbugs</groupId>
3662
<artifactId>jsr305</artifactId>
@@ -42,9 +68,9 @@
4268
<version>${nimbus-jose-jwt.version}</version>
4369
</dependency>
4470
<dependency>
45-
<groupId>javax.servlet</groupId>
46-
<artifactId>javax.servlet-api</artifactId>
47-
<version>${javax.servlet.version}</version>
71+
<groupId>javax.ws.rs</groupId>
72+
<artifactId>javax.ws.rs-api</artifactId>
73+
<version>${javax.ws.rs-api.version}</version>
4874
</dependency>
4975
<dependency>
5076
<groupId>net.minidev</groupId>
@@ -121,92 +147,36 @@
121147
</exclusion>
122148
</exclusions>
123149
</dependency>
124-
125-
<dependency>
126-
<groupId>org.graalvm.js</groupId>
127-
<artifactId>js</artifactId>
128-
<version>${graalvm.version}</version>
129-
</dependency>
130-
<dependency>
131-
<groupId>org.graalvm.js</groupId>
132-
<artifactId>js-scriptengine</artifactId>
133-
<version>${graalvm.version}</version>
134-
</dependency>
135-
<dependency>
136-
<groupId>org.graalvm.sdk</groupId>
137-
<artifactId>graal-sdk</artifactId>
138-
<version>${graalvm.version}</version>
139-
</dependency>
140-
<dependency>
141-
<groupId>org.graalvm.truffle</groupId>
142-
<artifactId>truffle-api</artifactId>
143-
<version>${graalvm.version}</version>
144-
</dependency>
145-
<dependency>
146-
<groupId>com.fasterxml.jackson.core</groupId>
147-
<artifactId>jackson-core</artifactId>
148-
<version>${fasterxml.jackson.version}</version>
149-
<scope>provided</scope>
150-
</dependency>
151-
<dependency>
152-
<groupId>com.fasterxml.jackson.core</groupId>
153-
<artifactId>jackson-databind</artifactId>
154-
<version>${fasterxml.jackson.databind.version}</version>
155-
<scope>provided</scope>
156-
</dependency>
157-
<dependency>
158-
<groupId>com.fasterxml.jackson.jaxrs</groupId>
159-
<artifactId>jackson-jaxrs-base</artifactId>
160-
<version>${fasterxml.jackson.version}</version>
161-
<scope>provided</scope>
162-
</dependency>
163-
<dependency>
164-
<groupId>com.fasterxml.jackson.jaxrs</groupId>
165-
<artifactId>jackson-jaxrs-json-provider</artifactId>
166-
<version>${fasterxml.jackson.version}</version>
167-
<scope>provided</scope>
168-
<exclusions>
169-
<exclusion>
170-
<groupId>jakarta.activation</groupId>
171-
<artifactId>jakarta.activation-api</artifactId>
172-
</exclusion>
173-
</exclusions>
174-
</dependency>
175-
<dependency>
176-
<groupId>jakarta.ws.rs</groupId>
177-
<artifactId>jakarta.ws.rs-api</artifactId>
178-
<version>${jakarta.ws.rs-api.version}</version>
179-
<scope>provided</scope>
180-
</dependency>
181150
<dependency>
182151
<groupId>org.glassfish.jersey.core</groupId>
183152
<artifactId>jersey-client</artifactId>
184153
<version>${jersey-client.version}</version>
185-
<scope>provided</scope>
186154
</dependency>
187155
<dependency>
188156
<groupId>org.glassfish.jersey.media</groupId>
189157
<artifactId>jersey-media-json-jackson</artifactId>
190158
<version>${jersey-client.version}</version>
191-
<scope>provided</scope>
192159
</dependency>
193-
<!-- Test -->
160+
<!-- Graal.js provides javax.script (graal.js) on JDK 15+ where Nashorn is removed -->
194161
<dependency>
195-
<groupId>org.junit.jupiter</groupId>
196-
<artifactId>junit-jupiter</artifactId>
197-
<version>${junit.jupiter.version}</version>
198-
<scope>test</scope>
162+
<groupId>org.graalvm.js</groupId>
163+
<artifactId>js</artifactId>
164+
<version>${graalvm.version}</version>
165+
</dependency>
166+
<dependency>
167+
<groupId>org.graalvm.js</groupId>
168+
<artifactId>js-scriptengine</artifactId>
169+
<version>${graalvm.version}</version>
199170
</dependency>
200171
<dependency>
201172
<groupId>org.mockito</groupId>
202173
<artifactId>mockito-core</artifactId>
203-
<version>${mockito.version}</version>
204-
<scope>test</scope>
205174
</dependency>
175+
<!-- Test -->
206176
<dependency>
207-
<groupId>org.mockito</groupId>
208-
<artifactId>mockito-inline</artifactId>
209-
<version>${mockito.version}</version>
177+
<groupId>org.junit.jupiter</groupId>
178+
<artifactId>junit-jupiter</artifactId>
179+
<version>${junit.jupiter.version}</version>
210180
<scope>test</scope>
211181
</dependency>
212182
<dependency>

agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerPolicyValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import java.util.Map;
4646
import java.util.Set;
4747

48-
import static org.mockito.Matchers.argThat;
48+
import static org.mockito.ArgumentMatchers.argThat;
4949
import static org.mockito.Mockito.mock;
5050
import static org.mockito.Mockito.when;
5151

agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyEngine.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,9 @@ public RangerAccessRequest deserialize(JsonElement jsonObj, Type type,
11661166
reqContext.put(RangerAccessRequestUtil.KEY_CONTEXT_ALL_ACCESSTYPE_GROUPS, setOfAccessTypeGroups);
11671167
}
11681168

1169+
// Match production preprocessing: resource matchers expand {USER} via token:USER in context
1170+
RangerAccessRequestUtil.setCurrentUserInContext(ret.getContext(), ret.getUser());
1171+
11691172
return ret;
11701173
}
11711174
}

agents-cred/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@
8484
<version>${junit.jupiter.version}</version>
8585
<scope>test</scope>
8686
</dependency>
87-
<dependency>
88-
<groupId>org.mockito</groupId>
89-
<artifactId>mockito-inline</artifactId>
90-
<version>${mockito.version}</version>
91-
<scope>test</scope>
92-
</dependency>
9387
<dependency>
9488
<groupId>org.mockito</groupId>
9589
<artifactId>mockito-junit-jupiter</artifactId>

hbase-agent/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,6 @@
262262
<artifactId>jersey-common</artifactId>
263263
<version>${jersey-client.version}</version>
264264
</dependency>
265-
<dependency>
266-
<groupId>org.mockito</groupId>
267-
<artifactId>mockito-core</artifactId>
268-
</dependency>
269265
<dependency>
270266
<groupId>javax.inject</groupId>
271267
<artifactId>javax.inject</artifactId>
@@ -594,12 +590,6 @@
594590
<version>${junit.jupiter.version}</version>
595591
<scope>test</scope>
596592
</dependency>
597-
<dependency>
598-
<groupId>org.mockito</groupId>
599-
<artifactId>mockito-inline</artifactId>
600-
<version>${mockito.version}</version>
601-
<scope>test</scope>
602-
</dependency>
603593
<dependency>
604594
<groupId>org.mockito</groupId>
605595
<artifactId>mockito-junit-jupiter</artifactId>

hdfs-agent/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,6 @@
284284
<version>${mockito.version}</version>
285285
<scope>test</scope>
286286
</dependency>
287-
<dependency>
288-
<groupId>org.mockito</groupId>
289-
<artifactId>mockito-inline</artifactId>
290-
<version>${mockito.version}</version>
291-
<scope>test</scope>
292-
</dependency>
293287
<dependency>
294288
<groupId>org.mockito</groupId>
295289
<artifactId>mockito-junit-jupiter</artifactId>

hive-agent/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,6 @@
446446
<version>${junit.jupiter.version}</version>
447447
<scope>test</scope>
448448
</dependency>
449-
<dependency>
450-
<groupId>org.mockito</groupId>
451-
<artifactId>mockito-inline</artifactId>
452-
<version>${mockito.version}</version>
453-
<scope>test</scope>
454-
</dependency>
455449
<dependency>
456450
<groupId>org.mockito</groupId>
457451
<artifactId>mockito-junit-jupiter</artifactId>

knox-agent/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,6 @@
296296
<version>${junit.jupiter.version}</version>
297297
<scope>test</scope>
298298
</dependency>
299-
<dependency>
300-
<groupId>org.mockito</groupId>
301-
<artifactId>mockito-inline</artifactId>
302-
<version>${mockito.version}</version>
303-
<scope>test</scope>
304-
</dependency>
305299
<dependency>
306300
<groupId>org.mockito</groupId>
307301
<artifactId>mockito-junit-jupiter</artifactId>

pdp/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<artifactId>nimbus-jose-jwt</artifactId>
5555
<version>${nimbus-jose-jwt.version}</version>
5656
</dependency>
57-
<!-- Jersey-1 client pieces needed by ranger-plugins-common -->
57+
<!-- Shared deps with ranger-plugins-common (Jersey 2 client stack is declared there) -->
5858
<dependency>
5959
<groupId>commons-codec</groupId>
6060
<artifactId>commons-codec</artifactId>

plugin-kafka/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
<dependency>
203203
<groupId>org.junit.platform</groupId>
204204
<artifactId>junit-platform-launcher</artifactId>
205-
<version>1.10.0</version>
205+
<version>${junit.platform.version}</version>
206206
<scope>test</scope>
207207
</dependency>
208208
</dependencies>

0 commit comments

Comments
 (0)