[
https://issues.apache.org/jira/browse/FLINK-5860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16553744#comment-16553744
]
ASF GitHub Bot commented on FLINK-5860:
---------------------------------------
GitHub user maheshsenni opened a pull request:
https://github.com/apache/flink/pull/6399
[FLINK-5860] [tests] Replace java.io.tmpdir with JUnit TemporaryFolder in
tests
## What is the purpose of the change
JUnit's TemporaryFolder is a better way to handle temporary folders in
tests as JUnit takes care of creation and cleanup of temporary files and
folders automatically.
## Brief change log
Replaced usage of `java.io.tmpdir` with `org.junit.rules.TemporaryFolder`
in test files.
## Verifying this change
The change addresses the usage of `java.io.tmpdir` in test files with a
suitable replacement offered by JUnit. This doesn't change the functionality or
validity of the tests.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Yarn/Mesos, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/maheshsenni/flink master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/6399.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #6399
----
commit 46f3c504e4cbfe830066bc6bc34ceeb8340272ff
Author: Mahesh Senniappan <mahesh.h4evr@...>
Date: 2018-07-23T02:35:40Z
[FLINK-5860] [tests] Replace java.io.tmpdir with JUnit TemporaryFolder in
tests
JUnit's TemporaryFolder is a better way to handle temporary folders
in tests as JUnit takes care of creation and cleanup of temporary
folders automatically.
----
> Replace all the file creating from java.io.tmpdir with TemporaryFolder
> ----------------------------------------------------------------------
>
> Key: FLINK-5860
> URL: https://issues.apache.org/jira/browse/FLINK-5860
> Project: Flink
> Issue Type: Test
> Components: Tests
> Reporter: shijinkui
> Assignee: Mahesh Senniappan
> Priority: Major
> Labels: pull-request-available, starter
>
> Search `System.getProperty("java.io.tmpdir")` in whole Flink project. It will
> get a Unit test list. Replace all the file creating from `java.io.tmpdir`
> with TemporaryFolder.
> Who can fix this problem thoroughly?
> ```
> $ grep -ri 'System.getProperty("java.io.tmpdir")' .
> ./flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/example/CassandraTupleWriteAheadSinkExample.java:
> env.setStateBackend(new FsStateBackend("file:///" +
> System.getProperty("java.io.tmpdir") + "/flink/backend"));
> ./flink-connectors/flink-connector-kafka-0.10/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestEnvironmentImpl.java:
> File tempDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-connectors/flink-connector-kafka-0.8/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestEnvironmentImpl.java:
> File tempDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-connectors/flink-connector-kafka-0.9/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestEnvironmentImpl.java:
> File tempDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-contrib/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackendConfigTest.java:
> return getMockEnvironment(new File[] { new
> File(System.getProperty("java.io.tmpdir")) });
> ./flink-core/src/main/java/org/apache/flink/configuration/ConfigConstants.java:
> public static final String DEFAULT_TASK_MANAGER_TMP_PATH =
> System.getProperty("java.io.tmpdir");
> ./flink-core/src/test/java/org/apache/flink/api/common/io/EnumerateNestedFilesTest.java:
> final String tempPath = System.getProperty("java.io.tmpdir");
> ./flink-core/src/test/java/org/apache/flink/testutils/TestConfigUtils.java:
> final File tempDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-core/src/test/java/org/apache/flink/testutils/TestFileUtils.java:
> File tempDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-core/src/test/java/org/apache/flink/testutils/TestFileUtils.java:
> File tempDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/clustering/util/KMeansDataGenerator.java:
> final String outDir = params.get("output",
> System.getProperty("java.io.tmpdir"));
> ./flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/ml/util/LinearRegressionDataGenerator.java:
> final String tmpDir = System.getProperty("java.io.tmpdir");
> ./flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/util/WebLogDataGenerator.java:
> final String outPath = System.getProperty("java.io.tmpdir");
> ./flink-java8/src/test/java/org/apache/flink/runtime/util/JarFileCreatorLambdaTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-java8/src/test/java/org/apache/flink/runtime/util/JarFileCreatorLambdaTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-java8/src/test/java/org/apache/flink/runtime/util/JarFileCreatorLambdaTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-java8/src/test/java/org/apache/flink/runtime/util/JarFileCreatorLambdaTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/PythonPlanBinder.java:
> public static final String FLINK_PYTHON_FILE_PATH =
> System.getProperty("java.io.tmpdir") + File.separator + "flink_plan";
> ./flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/PythonPlanBinder.java:
> public static final String FLINK_TMP_DATA_DIR =
> System.getProperty("java.io.tmpdir") + File.separator + "flink_data";
> ./flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/PythonPlanBinder.java:
> FLINK_HDFS_PATH = "file:" +
> System.getProperty("java.io.tmpdir") + File.separator + "flink";
> ./flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobUtils.java:
> baseDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java:
> return System.getProperty("java.io.tmpdir");
> ./flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/FlinkZooKeeperQuorumPeer.java:
> System.getProperty("java.io.tmpdir"),
> UUID.randomUUID().toString());
> ./flink-runtime/src/test/java/org/apache/flink/runtime/io/network/api/serialization/SpanningRecordSerializationTest.java:
> new String[] {
> System.getProperty("java.io.tmpdir") });
> ./flink-runtime/src/test/java/org/apache/flink/runtime/io/network/serialization/LargeRecordsTest.java:
> new String[] {
> System.getProperty("java.io.tmpdir") } );
> ./flink-runtime/src/test/java/org/apache/flink/runtime/operators/DataSinkTaskTest.java:
> String path = System.getProperty("java.io.tmpdir");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStateOutputStreamTest.java:
> private static final Path TEMP_DIR_PATH = new Path(new
> File(System.getProperty("java.io.tmpdir")).toURI());
> ./flink-runtime/src/test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java:
> File tempDir = new File(System.getProperty("java.io.tmpdir"));
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/JarFileCreatorTest.java:
> File out = new File(System.getProperty("java.io.tmpdir"),
> "jarcreatortest.jar");
> ./flink-runtime/src/test/java/org/apache/flink/runtime/util/TestingTaskManagerRuntimeInfo.java:
> this(new Configuration(),
> System.getProperty("java.io.tmpdir").split(",|" + File.pathSeparator));
> ./flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java:
> return
> configuration.getString(ConfigConstants.JOB_MANAGER_WEB_TMPDIR_KEY,
> System.getProperty("java.io.tmpdir"));
> ./flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkILoop.scala:
> System.getProperty("java.io.tmpdir"),
> ./flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java:
> new TestingTaskManagerRuntimeInfo(taskManagerConfig, new
> String[] {System.getProperty("java.io.tmpdir")}),
> ./flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/TestBaseUtils.java:
> String path = System.getProperty("java.io.tmpdir");
> ./flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/core/testutils/CommonTestUtils.java:
> return System.getProperty("java.io.tmpdir");
> ./flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java:
> String defaultPropertiesFileLocation =
> System.getProperty("java.io.tmpdir");
> ```
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)