This is an automated email from the ASF dual-hosted git repository. matthiasblaesing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 2ca7b66 Fix tests in ide/db.mysql module new 26ae16e Merge pull request #1439 from blackleg/fix_ide_db_mysql_tests 2ca7b66 is described below commit 2ca7b667c3ae79e932db3b7ec188f89f9124829d Author: Hector Espert <hectorespertpa...@gmail.com> AuthorDate: Sun Aug 18 14:00:54 2019 +0200 Fix tests in ide/db.mysql module --- .../org/netbeans/modules/db/mysql/test/TestBase.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ide/db.mysql/test/unit/src/org/netbeans/modules/db/mysql/test/TestBase.java b/ide/db.mysql/test/unit/src/org/netbeans/modules/db/mysql/test/TestBase.java index f3a7189..83d5af0 100644 --- a/ide/db.mysql/test/unit/src/org/netbeans/modules/db/mysql/test/TestBase.java +++ b/ide/db.mysql/test/unit/src/org/netbeans/modules/db/mysql/test/TestBase.java @@ -20,6 +20,7 @@ package org.netbeans.modules.db.mysql.test; import java.io.File; +import java.util.logging.Logger; import org.netbeans.api.db.explorer.ConnectionManager; import org.netbeans.api.db.explorer.DatabaseConnection; import org.netbeans.api.db.explorer.JDBCDriver; @@ -35,6 +36,11 @@ import org.openide.util.Lookup; * @author David */ public class TestBase extends NbTestCase { + + private static final Logger LOG = Logger.getLogger(TestBase.class.getName()); + + private static final String DRIVER_CLASSNAME = "com.mysql.jdbc.Driver"; + private String host; private String port; private String user; @@ -43,8 +49,6 @@ public class TestBase extends NbTestCase { private String schema; private String dbname; - private static String DRIVER_CLASSNAME = "com.mysql.jdbc.Driver"; - private JDBCDriver jdbcDriver; private static DatabaseConnection dbconn; @@ -53,6 +57,17 @@ public class TestBase extends NbTestCase { } @Override + public boolean canRun() { + try { + Class.forName(DRIVER_CLASSNAME); + return super.canRun(); + } catch (ClassNotFoundException e) { + LOG.warning(String.format("Test %s in %s disabled, %s not available", this.getName(), this.getClass().getName(), e.getMessage())); + return false; + } + } + + @Override public void setUp() throws Exception { super.setUp(); Lookup.getDefault().lookup(ModuleInfo.class); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists