This is an automated email from the ASF dual-hosted git repository. jihoonson pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push: new 62e5800 Use JUnit TemporaryFolder rule instead of system temp folder (#6070) 62e5800 is described below commit 62e580050c7e997053a4149a4d5e5f958da7f2b7 Author: Kirill Kozlov <yuppie-...@users.noreply.github.com> AuthorDate: Thu Aug 16 20:05:45 2018 +0200 Use JUnit TemporaryFolder rule instead of system temp folder (#6070) * Use JUnit TemporaryFolder rule instead of system tmp folder * Allow to forbid apis which present not in all mvn modules --- codestyle/druid-forbidden-apis.txt | 3 ++- pom.xml | 1 + .../segment/data/CompressedColumnarIntsSerializerTest.java | 8 ++++++-- .../data/CompressedVSizeColumnarIntsSerializerTest.java | 11 ++++++++--- .../V3CompressedVSizeColumnarMultiIntsSerializerTest.java | 8 ++++++-- .../LargeColumnSupportedComplexColumnSerializerTest.java | 8 ++++++-- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/codestyle/druid-forbidden-apis.txt b/codestyle/druid-forbidden-apis.txt index 7f56d9a..c7bd111 100644 --- a/codestyle/druid-forbidden-apis.txt +++ b/codestyle/druid-forbidden-apis.txt @@ -3,4 +3,5 @@ com.google.common.collect.Maps#newConcurrentMap() @ Create java.util.concurrent. com.google.common.util.concurrent.Futures#transform(com.google.common.util.concurrent.ListenableFuture, com.google.common.util.concurrent.AsyncFunction) @ Use io.druid.java.util.common.concurrent.ListenableFutures#transformAsync com.google.common.collect.Iterators#emptyIterator() @ Use java.util.Collections#emptyIterator() com.google.common.base.Charsets @ Use java.nio.charset.StandardCharsets instead -java.io.File#toURL() @ Use java.io.File#toURI() and java.net.URI#toURL() instead \ No newline at end of file +java.io.File#toURL() @ Use java.io.File#toURI() and java.net.URI#toURL() instead +org.apache.commons.io.FileUtils#getTempDirectory() @ Use org.junit.rules.TemporaryFolder for tests instead \ No newline at end of file diff --git a/pom.xml b/pom.xml index 641c552..a7bc4fa 100644 --- a/pom.xml +++ b/pom.xml @@ -910,6 +910,7 @@ <artifactId>forbiddenapis</artifactId> <version>2.3</version> <configuration> + <failOnUnresolvableSignatures>false</failOnUnresolvableSignatures> <bundledSignatures> <!-- This will automatically choose the right diff --git a/processing/src/test/java/io/druid/segment/data/CompressedColumnarIntsSerializerTest.java b/processing/src/test/java/io/druid/segment/data/CompressedColumnarIntsSerializerTest.java index 0d8fe55..c990305 100644 --- a/processing/src/test/java/io/druid/segment/data/CompressedColumnarIntsSerializerTest.java +++ b/processing/src/test/java/io/druid/segment/data/CompressedColumnarIntsSerializerTest.java @@ -32,11 +32,12 @@ import io.druid.segment.writeout.OffHeapMemorySegmentWriteOutMedium; import io.druid.segment.writeout.SegmentWriteOutMedium; import io.druid.segment.writeout.WriteOutBytes; import it.unimi.dsi.fastutil.ints.IntArrayList; -import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -61,6 +62,9 @@ public class CompressedColumnarIntsSerializerTest private final Random rand = new Random(0); private int[] vals; + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + public CompressedColumnarIntsSerializerTest( CompressionStrategy compressionStrategy, ByteOrder byteOrder @@ -112,7 +116,7 @@ public class CompressedColumnarIntsSerializerTest private void checkSerializedSizeAndData(int chunkFactor) throws Exception { - FileSmoosher smoosher = new FileSmoosher(FileUtils.getTempDirectory()); + FileSmoosher smoosher = new FileSmoosher(temporaryFolder.newFolder()); CompressedColumnarIntsSerializer writer = new CompressedColumnarIntsSerializer( segmentWriteOutMedium, "test", chunkFactor, byteOrder, compressionStrategy diff --git a/processing/src/test/java/io/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java b/processing/src/test/java/io/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java index e32ee35..5aa011d 100644 --- a/processing/src/test/java/io/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java +++ b/processing/src/test/java/io/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java @@ -32,11 +32,12 @@ import io.druid.segment.writeout.OffHeapMemorySegmentWriteOutMedium; import io.druid.segment.writeout.SegmentWriteOutMedium; import io.druid.segment.writeout.WriteOutBytes; import it.unimi.dsi.fastutil.ints.IntArrayList; -import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -58,6 +59,10 @@ public class CompressedVSizeColumnarIntsSerializerTest private final ByteOrder byteOrder; private final Random rand = new Random(0); private int[] vals; + + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + public CompressedVSizeColumnarIntsSerializerTest( CompressionStrategy compressionStrategy, ByteOrder byteOrder @@ -109,7 +114,7 @@ public class CompressedVSizeColumnarIntsSerializerTest private void checkSerializedSizeAndData(int chunkSize) throws Exception { - FileSmoosher smoosher = new FileSmoosher(FileUtils.getTempDirectory()); + FileSmoosher smoosher = new FileSmoosher(temporaryFolder.newFolder()); CompressedVSizeColumnarIntsSerializer writer = new CompressedVSizeColumnarIntsSerializer( segmentWriteOutMedium, @@ -181,7 +186,7 @@ public class CompressedVSizeColumnarIntsSerializerTest private void checkV2SerializedSizeAndData(int chunkSize) throws Exception { - File tmpDirectory = FileUtils.getTempDirectory(); + File tmpDirectory = temporaryFolder.newFolder(); FileSmoosher smoosher = new FileSmoosher(tmpDirectory); GenericIndexedWriter genericIndexed = GenericIndexedWriter.ofCompressedByteBuffers( diff --git a/processing/src/test/java/io/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java b/processing/src/test/java/io/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java index 1a1996a..2775567 100644 --- a/processing/src/test/java/io/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java +++ b/processing/src/test/java/io/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java @@ -33,10 +33,11 @@ import io.druid.java.util.common.io.smoosh.SmooshedWriter; import io.druid.segment.writeout.OffHeapMemorySegmentWriteOutMedium; import io.druid.segment.writeout.SegmentWriteOutMedium; import io.druid.segment.writeout.WriteOutBytes; -import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -67,6 +68,9 @@ public class V3CompressedVSizeColumnarMultiIntsSerializerTest private final Random rand = new Random(0); private List<int[]> vals; + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + public V3CompressedVSizeColumnarMultiIntsSerializerTest( CompressionStrategy compressionStrategy, ByteOrder byteOrder @@ -111,7 +115,7 @@ public class V3CompressedVSizeColumnarMultiIntsSerializerTest private void checkSerializedSizeAndData(int offsetChunkFactor, int valueChunkFactor) throws Exception { - FileSmoosher smoosher = new FileSmoosher(FileUtils.getTempDirectory()); + FileSmoosher smoosher = new FileSmoosher(temporaryFolder.newFolder()); try (SegmentWriteOutMedium segmentWriteOutMedium = new OffHeapMemorySegmentWriteOutMedium()) { int maxValue = vals.size() > 0 ? getMaxValue(vals) : 0; diff --git a/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java b/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java index 29f2a06..e252975 100644 --- a/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java +++ b/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java @@ -34,9 +34,10 @@ import io.druid.segment.column.ComplexColumn; import io.druid.segment.column.ValueType; import io.druid.segment.writeout.OffHeapMemorySegmentWriteOutMedium; import io.druid.segment.writeout.SegmentWriteOutMedium; -import org.apache.commons.io.FileUtils; import org.junit.Assert; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; import javax.annotation.Nullable; import java.io.File; @@ -47,6 +48,9 @@ public class LargeColumnSupportedComplexColumnSerializerTest private final HashFunction fn = Hashing.murmur3_128(); + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + @Test public void testSanity() throws IOException { @@ -63,7 +67,7 @@ public class LargeColumnSupportedComplexColumnSerializerTest for (int columnSize : columnSizes) { for (int aCase : cases) { - File tmpFile = FileUtils.getTempDirectory(); + File tmpFile = temporaryFolder.newFolder(); HyperLogLogCollector baseCollector = HyperLogLogCollector.makeLatestCollector(); try (SegmentWriteOutMedium segmentWriteOutMedium = new OffHeapMemorySegmentWriteOutMedium(); FileSmoosher v9Smoosher = new FileSmoosher(tmpFile)) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org