1
0

[HUDI-622]: Remove VisibleForTesting annotation and import from code (#1343)

* HUDI:622: Remove VisibleForTesting annotation and import from code
This commit is contained in:
Suneel Marthi
2020-02-20 02:17:53 -05:00
committed by GitHub
parent c2b08cdfc9
commit f9d2f66dc1
18 changed files with 6 additions and 49 deletions

View File

@@ -145,8 +145,8 @@ abstract class InternalFilter implements Writable {
if (keys == null) {
throw new IllegalArgumentException("Key[] may not be null");
}
for (int i = 0; i < keys.length; i++) {
add(keys[i]);
for (Key key : keys) {
add(key);
}
} //end add()

View File

@@ -169,7 +169,7 @@ public final class BufferedRandomAccessFile extends RandomAccessFile {
private int fillBuffer() throws IOException {
int cnt = 0;
int bytesToRead = this.capacity;
/** blocking read, until buffer is filled or EOF reached */
// blocking read, until buffer is filled or EOF reached
while (bytesToRead > 0) {
int n = super.read(this.dataBuffer.array(), cnt, bytesToRead);
if (n < 0) {

View File

@@ -28,7 +28,6 @@ import org.apache.hudi.exception.HoodieException;
import org.apache.hudi.exception.HoodieIOException;
import org.apache.hudi.exception.InvalidHoodiePathException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -216,7 +215,6 @@ public class FSUtils {
* @param excludeMetaFolder Exclude .hoodie folder
* @throws IOException
*/
@VisibleForTesting
static void processFiles(FileSystem fs, String basePathStr, Function<FileStatus, Boolean> consumer,
boolean excludeMetaFolder) throws IOException {
PathFilter pathFilter = excludeMetaFolder ? getExcludeMetaPathFilter() : ALLOW_ALL_FILTER;

View File

@@ -16,7 +16,6 @@
package org.apache.hudi.common.util;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -252,7 +251,6 @@ public class ObjectSizeCalculator {
size += objectSize;
}
@VisibleForTesting
static long roundTo(long x, int multiple) {
return ((x + multiple - 1) / multiple) * multiple;
}
@@ -325,7 +323,6 @@ public class ObjectSizeCalculator {
throw new AssertionError("Encountered unexpected primitive type " + type.getName());
}
@VisibleForTesting
static MemoryLayoutSpecification getEffectiveMemoryLayoutSpecification() {
final String vmName = System.getProperty("java.vm.name");
if (vmName == null || !(vmName.startsWith("Java HotSpot(TM) ") || vmName.startsWith("OpenJDK")

View File

@@ -22,7 +22,6 @@ import org.apache.hudi.common.util.collection.Pair;
import org.apache.hudi.exception.HoodieException;
import org.apache.hudi.exception.HoodieIOException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
@@ -450,7 +449,6 @@ public class RocksDBDAO {
}
}
@VisibleForTesting
String getRocksDBBasePath() {
return rocksDBBasePath;
}

View File

@@ -23,7 +23,6 @@ import org.apache.hudi.common.util.Option;
import org.apache.hudi.common.util.SizeEstimator;
import org.apache.hudi.exception.HoodieException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
@@ -62,7 +61,6 @@ public class BoundedInMemoryQueue<I, O> implements Iterable<O> {
// It indicates number of records to cache. We will be using sampled record's average size to
// determine how many
// records we should cache and will change (increase/decrease) permits accordingly.
@VisibleForTesting
public final Semaphore rateLimiter = new Semaphore(1);
// used for sampling records with "RECORD_SAMPLING_RATE" frequency.
public final AtomicLong samplingRecordCounter = new AtomicLong(-1);
@@ -86,10 +84,8 @@ public class BoundedInMemoryQueue<I, O> implements Iterable<O> {
private final QueueIterator iterator;
// indicates rate limit (number of records to cache). it is updated whenever there is a change
// in avg record size.
@VisibleForTesting
public int currentRateLimit = 1;
// indicates avg record size in bytes. It is updated whenever a new record is sampled.
@VisibleForTesting
public long avgRecordSizeInBytes = 0;
// indicates number of samples collected so far.
private long numSamples = 0;
@@ -119,7 +115,6 @@ public class BoundedInMemoryQueue<I, O> implements Iterable<O> {
this.iterator = new QueueIterator();
}
@VisibleForTesting
public int size() {
return this.queue.size();
}