Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-25479 Purge use of VisibleForTesting #77

Merged
merged 2 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;

/**
* a alternative implementation of a connection object that forwards the mutations to a kafka queue
Expand Down Expand Up @@ -76,9 +75,7 @@ public KafkaBridgeConnection(Configuration conf,
* @param conf hbase configuration
* @param routingRules a set of routing rules
* @param producer a kafka producer
* @throws IOException on error
*/
@VisibleForTesting
public KafkaBridgeConnection(Configuration conf, TopicRoutingRules routingRules,
Producer<byte[],byte[]> producer) {
this.conf = conf;
Expand Down
98 changes: 96 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<checkstyle.version>8.18</checkstyle.version>
<maven.checkstyle.version>3.1.0</maven.checkstyle.version>
<surefire.version>3.0.0-M4</surefire.version>
<enforcer.version>3.0.0-M3</enforcer.version>
<extra.enforcer.version>1.2</extra.enforcer.version>
<restrict-imports.enforcer.version>0.14.0</restrict-imports.enforcer.version>
<!--Internally we use a different version of protobuf. See hbase-protocol-shaded-->
<external.protobuf.version>2.5.0</external.protobuf.version>
<protobuf.plugin.version>0.5.0</protobuf.plugin.version>
Expand Down Expand Up @@ -437,12 +440,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>${enforcer.version}</version>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.2</version>
<version>${extra.enforcer.version}</version>
</dependency>
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>${restrict-imports.enforcer.version}</version>
</dependency>
</dependencies>
<!-- version set by parent -->
Expand Down Expand Up @@ -513,6 +521,92 @@
</rules>
</configuration>
</execution>
<execution>
<id>banned-illegal-imports</id>
<phase>process-sources</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>Use SLF4j for logging</reason>
<bannedImports>
<bannedImport>org.apache.commons.logging.Log</bannedImport>
<bannedImport>org.apache.commons.logging.LogFactory</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>Use shaded version in hbase-thirdparty</reason>
<bannedImports>
<bannedImport>com.google.common.**</bannedImport>
<bannedImport>io.netty.**</bannedImport>
<bannedImport>org.apache.commons.cli.**</bannedImport>
<bannedImport>org.apache.commons.collections.**</bannedImport>
<bannedImport>org.apache.commons.collections4.**</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>Do not use shaded classes from other dependencies</reason>
<bannedImports>
<bannedImport>org.apache.curator.shaded.**</bannedImport>
<bannedImport>org.apache.htrace.shaded.**</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>Use shaded gson in hbase-thirdparty</reason>
<bannedImports>
<bannedImport>org.codehaus.jackson.**</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>Use commons lang 3</reason>
<bannedImports>
<bannedImport>org.apache.commons.lang.**</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>Use yetus IA and IS annotations</reason>
<bannedImports>
<bannedImport>org.apache.hadoop.classificatio.**</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>Do not use htrace v3</reason>
<bannedImports>
<bannedImport>org.htrace.**</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>
You should never use this style of annotations(i.e, 'this is for test only')
in IA.Public or IA.LimitedPrivate classes. Use IA.Private to tell users this is
not for public use.
For IA.Private classes, use RestrictedApi annotation in error prone instead.
</reason>
<bannedImports>
<bannedImport>org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting</bannedImport>
</bannedImports>
</restrictImports>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!-- See https://maven.apache.org/maven-ci-friendly.html-->
Expand Down