exceptionfactory commented on a change in pull request #5794:
URL: https://github.com/apache/nifi/pull/5794#discussion_r814333264
##########
File path:
nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/test/java/org/apache/nifi/util/db/TestJdbcHugeStream.java
##########
@@ -53,21 +52,18 @@
*/
public class TestJdbcHugeStream {
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @BeforeClass
+ @BeforeAll
public static void setup() {
System.setProperty("derby.stream.error.file", "target/derby.log");
}
@Test
public void readSend2StreamHuge_FileBased() throws ClassNotFoundException,
SQLException, IOException {
-
- // remove previous test database, if any
- folder.delete();
-
- try (final Connection con =
createConnection(folder.getRoot().getAbsolutePath())) {
+ String path =
Files.createTempDirectory(String.valueOf(System.currentTimeMillis()))
+ .resolve("db")
+ .toFile()
+ .getAbsolutePath();
Review comment:
This test also needs a method for clearing the temporary database
directory.
##########
File path:
nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/test/java/org/apache/nifi/util/db/TestJdbcClobReadable.java
##########
@@ -83,9 +80,10 @@ public void testDriverLoad() throws ClassNotFoundException {
}
private void validateClob(String someClob) throws SQLException,
ClassNotFoundException, IOException {
- folder.delete();
-
- final Connection con =
createConnection(folder.getRoot().getAbsolutePath());
+ File folder =
Files.createTempDirectory(String.valueOf(System.currentTimeMillis()))
+ .resolve("db")
+ .toFile();
+ final Connection con = createConnection(folder.getAbsolutePath());
Review comment:
The updates to set the `derby.log` look good, but this test class still
needs a method to clear the database directory after each method execution.
##########
File path:
nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/test/java/org/apache/nifi/util/db/TestJdbcCommon.java
##########
@@ -84,23 +83,20 @@
private static final Logger LOGGER =
LoggerFactory.getLogger(TestJdbcCommon.class);
static final String createTable = "create table restaurants(id integer,
name varchar(20), city varchar(50))";
- @ClassRule
- public static TemporaryFolder folder = new TemporaryFolder();
-
/**
* Setting up Connection is expensive operation.
* So let's do this only once and reuse Connection in each test.
*/
static protected Connection con;
- @BeforeClass
- public static void setup() throws ClassNotFoundException, SQLException {
+ @BeforeAll
+ public static void setup() throws ClassNotFoundException, SQLException,
IOException {
System.setProperty("derby.stream.error.file", "target/derby.log");
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- // remove previous test database, if any
- folder.delete();
- String location = folder.getRoot().getAbsolutePath();
+ String location =
Files.createTempDirectory(String.valueOf(System.currentTimeMillis()))
+ .resolve("db")
+ .toFile().getAbsolutePath();
Review comment:
This test class still needs a method to clear the temporary database
directory after test method completion.
--
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]