Github user pnowojski commented on a diff in the pull request: https://github.com/apache/flink/pull/4561#discussion_r134759790 --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunctionTest.java --- @@ -185,11 +253,44 @@ protected void recoverAndAbort(FileTransaction transaction) { private static class FileTransaction { private final File tmpFile; - private final transient Writer writer; + private final transient BufferedWriter writer; public FileTransaction(File tmpFile) throws IOException { this.tmpFile = tmpFile; this.writer = new BufferedWriter(new FileWriter(tmpFile)); } + + @Override + public String toString() { + return String.format("FileTransaction[%s]", tmpFile.getName()); + } + } + + private static class TestContext implements AutoCloseable { + public final File tmpDirectory = Files.createTempDirectory(TwoPhaseCommitSinkFunctionTest.class.getSimpleName() + "_tmp").toFile(); + public final File targetDirectory = Files.createTempDirectory(TwoPhaseCommitSinkFunctionTest.class.getSimpleName() + "_target").toFile(); + + public FileBasedSinkFunction sinkFunction; + public OneInputStreamOperatorTestHarness<String, Object> harness; + + private TestContext() throws Exception { + tmpDirectory.deleteOnExit(); --- End diff -- I think I wouldn't be able to use the `@Rule` here for those directories. I would have to write my own rule, that would wrap whole `TestContext`, right? If so, can we leave as it is for know, because currently I'm getting stack overflow exceptions with number of opened issues that I'm currently working on ;)
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---