Skip to content

Commit e103c83

Browse files
authored
HADOOP-17952. Replace Guava VisibleForTesting by Hadoop's own annotation in hadoop-common-project modules (#3503)
Reviewed-by: Ahmed Hussein <ahussein@apache.org>
1 parent 8071dbb commit e103c83

File tree

159 files changed

+311
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+311
-154
lines changed

hadoop-common-project/hadoop-auth/pom.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,38 @@
248248
<excludeFilterFile>${basedir}/dev-support/findbugsExcludeFile.xml</excludeFilterFile>
249249
</configuration>
250250
</plugin>
251+
<plugin>
252+
<groupId>org.apache.maven.plugins</groupId>
253+
<artifactId>maven-enforcer-plugin</artifactId>
254+
<dependencies>
255+
<dependency>
256+
<groupId>de.skuzzle.enforcer</groupId>
257+
<artifactId>restrict-imports-enforcer-rule</artifactId>
258+
<version>${restrict-imports.enforcer.version}</version>
259+
</dependency>
260+
</dependencies>
261+
<executions>
262+
<execution>
263+
<id>banned-illegal-imports</id>
264+
<phase>process-sources</phase>
265+
<goals>
266+
<goal>enforce</goal>
267+
</goals>
268+
<configuration>
269+
<rules>
270+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
271+
<includeTestCode>true</includeTestCode>
272+
<reason>Use hadoop-common provided VisibleForTesting rather than the one provided by Guava</reason>
273+
<bannedImports>
274+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting</bannedImport>
275+
<bannedImport>com.google.common.annotations.VisibleForTesting</bannedImport>
276+
</bannedImports>
277+
</restrictImports>
278+
</rules>
279+
</configuration>
280+
</execution>
281+
</executions>
282+
</plugin>
251283
</plugins>
252284
</build>
253285

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
package org.apache.hadoop.security.authentication.client;
1515

16-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
16+
import org.apache.hadoop.classification.VisibleForTesting;
1717
import java.lang.reflect.Constructor;
1818
import org.apache.commons.codec.binary.Base64;
1919
import org.apache.hadoop.security.authentication.server.HttpConstants;

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/JWTRedirectAuthenticationHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
import java.security.interfaces.RSAPublicKey;
3030

31-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
31+
import org.apache.hadoop.classification.VisibleForTesting;
3232
import org.apache.hadoop.security.authentication.client.AuthenticationException;
3333
import org.apache.hadoop.security.authentication.util.CertificateUtil;
3434
import org.slf4j.Logger;

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/KerberosAuthenticationHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
package org.apache.hadoop.security.authentication.server;
1515

16-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
16+
import org.apache.hadoop.classification.VisibleForTesting;
1717
import org.apache.hadoop.security.authentication.client.AuthenticationException;
1818
import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
1919
import org.apache.commons.codec.binary.Base64;

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/LdapAuthenticationHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import org.slf4j.Logger;
3939
import org.slf4j.LoggerFactory;
4040

41-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
41+
import org.apache.hadoop.classification.VisibleForTesting;
4242
import org.apache.hadoop.thirdparty.com.google.common.base.Preconditions;
4343

4444
/**

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosName.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.util.regex.Matcher;
2727
import java.util.regex.Pattern;
2828

29-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
29+
import org.apache.hadoop.classification.VisibleForTesting;
3030
import org.apache.hadoop.classification.InterfaceAudience;
3131
import org.apache.hadoop.classification.InterfaceStability;
3232
import org.slf4j.Logger;

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/RandomSignerSecretProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
package org.apache.hadoop.security.authentication.util;
1515

16-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
16+
import org.apache.hadoop.classification.VisibleForTesting;
1717

1818
import java.security.SecureRandom;
1919
import java.util.Random;

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/RolloverSignerSecretProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.util.concurrent.ScheduledExecutorService;
1919
import java.util.concurrent.TimeUnit;
2020
import javax.servlet.ServletContext;
21-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
21+
import org.apache.hadoop.classification.VisibleForTesting;
2222
import org.apache.hadoop.classification.InterfaceAudience;
2323
import org.apache.hadoop.classification.InterfaceStability;
2424
import org.slf4j.Logger;

hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/ZKSignerSecretProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
package org.apache.hadoop.security.authentication.util;
1515

16-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
16+
import org.apache.hadoop.classification.VisibleForTesting;
1717
import java.nio.ByteBuffer;
1818
import java.security.SecureRandom;
1919
import java.util.Collections;

hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/util/StringSignerSecretProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.util.Properties;
1818
import javax.servlet.ServletContext;
1919

20-
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
20+
import org.apache.hadoop.classification.VisibleForTesting;
2121
import org.apache.hadoop.classification.InterfaceAudience;
2222
import org.apache.hadoop.classification.InterfaceStability;
2323
import org.apache.hadoop.security.authentication.server.AuthenticationFilter;

0 commit comments

Comments
 (0)