clebertsuconic commented on code in PR #4407:
URL: https://github.com/apache/activemq-artemis/pull/4407#discussion_r1140345516
##########
artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManagerTest.java:
##########
@@ -56,29 +57,34 @@ public void configure() {
dbConf.setJdbcUser(getJdbcUser());
dbConf.setJdbcPassword(getJdbcPassword());
leaseLockExecutor = Executors.newSingleThreadScheduledExecutor();
+ runAfter(leaseLockExecutor::shutdownNow);
}
- @After
- public void shutdownExecutors() throws InterruptedException {
- try {
- final CountDownLatch latch = new CountDownLatch(1);
- leaseLockExecutor.execute(latch::countDown);
- Assert.assertTrue("the scheduler of the lease lock has some pending
task in ", latch.await(10, TimeUnit.SECONDS));
- } finally {
- leaseLockExecutor.shutdownNow();
- }
- }
- @After
@Override
- public void shutdownDerby() {
- try {
- if (useAuthentication) {
- DriverManager.getConnection("jdbc:derby:;shutdown=true",
getJdbcUser(), getJdbcPassword());
- } else {
- DriverManager.getConnection("jdbc:derby:;shutdown=true");
+ public void dropDerby() {
+ if (useAuthentication) {
+ try {
+ DriverManager.getConnection("jdbc:derby:" +
getEmbeddedDataBaseName() + ";drop=true", getJdbcUser(), getJdbcPassword());
+ } catch (Exception e) {
+ logger.info(e.getMessage());
+ }
+ try {
+
DriverManager.getConnection("jdbc:derby:;shutdown=true;deregister=false",
getJdbcUser(), getJdbcPassword());
+ } catch (Exception e) {
+ logger.info(e.getMessage());
+ }
+ } else {
+ try {
+ DriverManager.getConnection("jdbc:derby:" +
getEmbeddedDataBaseName() + ";drop=true");
+ } catch (Exception e) {
+ logger.info(e.getMessage());
+ }
+ try {
+
DriverManager.getConnection("jdbc:derby:;shutdown=true;deregister=false");
+ } catch (Exception e) {
+ logger.info(e.getMessage());
Review Comment:
I actually added code on the upper method for this...
let me check if I'm doing it right
--
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]