MikeThomsen commented on pull request #5794:
URL: https://github.com/apache/nifi/pull/5794#issuecomment-1051104530
`FileUtils.deleteFile` is not getting called multiple times anymore. This is
the current code, and it's failing:
```
@BeforeAll
public static void beforeAll() throws ClassNotFoundException {
final File derbyLog = new File(System.getProperty("java.io.tmpdir"),
"derby.log");
derbyLog.deleteOnExit();
System.setProperty(DERBY_LOG_PROPERTY, derbyLog.getAbsolutePath());
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
}
@AfterAll
public static void clearDerbyLog() {
System.clearProperty(DERBY_LOG_PROPERTY);
}
@BeforeEach
public void setup() throws ClassNotFoundException, SQLException,
IOException {
tempFile = new File(System.getProperty("java.io.tmpdir"),
(this.getClass().getSimpleName() + "-" + UUID.randomUUID()));
String location = tempFile.getAbsolutePath();
con = DriverManager.getConnection("jdbc:derby:" + location +
";create=true");
try (final Statement stmt = con.createStatement()) {
stmt.executeUpdate(createTable);
}
}
@AfterEach
public void cleanup() throws IOException {
if (tempFile.exists()) {
final SQLException exception = assertThrows(SQLException.class,
() -> DriverManager.getConnection("jdbc:derby:;shutdown=true"));
assertEquals("XJ015", exception.getSQLState());
// FileUtils.deleteFile(tempFile, true);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]