dan-s1 commented on code in PR #11761:
URL: https://github.com/apache/nifi/pull/11761#discussion_r4395084039
##########
nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/record/sink/db/DatabaseRecordSinkTest.java:
##########
@@ -90,89 +92,102 @@ public class DatabaseRecordSinkTest {
private static final String SERVICE_ID =
DBCPConnectionPool.class.getName();
private static final String DRIVER_CLASS = "org.hsqldb.jdbc.JDBCDriver";
- private static final String CONNECTION_URL_FORMAT = "jdbc:hsqldb:file:%s";
+ private static final String CONNECTION_URL_FORMAT =
"jdbc:hsqldb:file:%s/nifi";
private String connectionUrl;
private DBCPConnectionPool dbcpService;
+ private TestRunner runner;
@BeforeEach
public void setService(@TempDir final Path tempDir) throws
InitializationException {
dbcpService = new DBCPConnectionPool();
- TestRunner runner = TestRunners.newTestRunner(NoOpProcessor.class);
+ runner = TestRunners.newTestRunner(NoOpProcessor.class);
runner.addControllerService(SERVICE_ID, dbcpService);
- connectionUrl = CONNECTION_URL_FORMAT.formatted(tempDir);
+ connectionUrl =
CONNECTION_URL_FORMAT.formatted(tempDir.toAbsolutePath());
runner.setProperty(dbcpService, DATABASE_URL, connectionUrl);
runner.setProperty(dbcpService, DB_USER, String.class.getSimpleName());
runner.setProperty(dbcpService, DB_PASSWORD, String.class.getName());
runner.setProperty(dbcpService, DB_DRIVERNAME, DRIVER_CLASS);
}
+ @AfterEach
+ public void shutdownDatabase() throws SQLException {
+ runner.shutdown();
+ dbcpService.shutdown();
+
+ try (Connection conn = DriverManager.getConnection(connectionUrl);
Review Comment:
@exceptionfactory When I make those changes I get the following stack trace
for each of the tests:
```
java.sql.SQLInvalidAuthorizationSpecException: invalid authorization
specification - not found: String
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at
org.apache.nifi.record.sink.db.DatabaseRecordSinkTest.shutdownDatabase(DatabaseRecordSinkTest.java:133)
Caused by: org.hsqldb.HsqlException: invalid authorization specification -
not found: String
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.rights.UserManager.get(Unknown Source)
at org.hsqldb.rights.UserManager.getUser(Unknown Source)
at org.hsqldb.Database.connect(Unknown Source)
at org.hsqldb.DatabaseManager.newSession(Unknown Source)
... 4 more
```
--
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]