Skip to content
Permalink
Browse files

[misc] testing correction when testSingleHost is false

(cherry picked from commit 7db9cbb)
  • Loading branch information...
rusher committed Jun 18, 2018
1 parent 542cac0 commit 0abceec4124783874b50c8bc3dd70e703978c1d2
@@ -376,9 +376,12 @@ public static void createFunction(String name, String body) throws SQLException
* @throws SQLException if any error occur
*/
public boolean anonymousUser() throws SQLException {
Statement stmt = sharedConnection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM mysql.user u where u.Host='localhost' and u.User=''");
return rs.next();
if (testSingleHost) {
Statement stmt = sharedConnection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM mysql.user u where u.Host='localhost' and u.User=''");
return rs.next();
}
return false;
}

/**
@@ -388,8 +391,11 @@ public boolean anonymousUser() throws SQLException {
* @throws SQLException exception
*/
static boolean isMariadbServer() throws SQLException {
DatabaseMetaData md = sharedConnection.getMetaData();
return md.getDatabaseProductVersion().contains("MariaDB");
if (testSingleHost) {
DatabaseMetaData md = sharedConnection.getMetaData();
return md.getDatabaseProductVersion().contains("MariaDB");
}
return false;
}

/**
@@ -53,6 +53,7 @@
package org.mariadb.jdbc.failover;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.mariadb.jdbc.BaseTest;
@@ -72,11 +73,14 @@
*/
@Before
public void init() {
masterDownUrl = "jdbc:mariadb:replication//" + hostname + ":9999"
+ "," + hostname + ((port == 0) ? "" : ":" + port)
+ "/" + database + "?user=" + username
+ ((password != null) ? "&password=" + password : "")
+ "&retriesAllDown=10&allowMasterDownConnection";
Assume.assumeTrue(testSingleHost);
if (testSingleHost) {
masterDownUrl = "jdbc:mariadb:replication//" + hostname + ":9999"
+ "," + hostname + ((port == 0) ? "" : ":" + port)
+ "/" + database + "?user=" + username
+ ((password != null) ? "&password=" + password : "")
+ "&retriesAllDown=10&allowMasterDownConnection";
}
}

@Test

0 comments on commit 0abceec

Please sign in to comment.
You can’t perform that action at this time.