|
7 | 7 | import static org.junit.jupiter.api.Assertions.*; |
8 | 8 |
|
9 | 9 | import java.sql.*; |
10 | | -import org.junit.jupiter.api.AfterAll; |
11 | | -import org.junit.jupiter.api.Assumptions; |
12 | | -import org.junit.jupiter.api.BeforeAll; |
13 | | -import org.junit.jupiter.api.Test; |
| 10 | + |
| 11 | +import org.junit.jupiter.api.*; |
14 | 12 |
|
15 | 13 | public class ConfigurationTest extends Common { |
16 | 14 |
|
@@ -59,12 +57,24 @@ public void testSessionVariable() throws SQLException { |
59 | 57 | Statement stmt = connection.createStatement(); |
60 | 58 | ResultSet rs = stmt.executeQuery("SELECT @@session_track_system_variables"); |
61 | 59 | assertTrue(rs.next()); |
| 60 | + } catch (SQLException e) { |
| 61 | + // in case server check variable validity |
| 62 | + Assertions.assertTrue(e.getCause().getMessage().contains("Unknown system variable 'some';f'")); |
62 | 63 | } |
63 | 64 | try (Connection connection = |
64 | 65 | createCon("sessionVariables=session_track_system_variables=\"some\\\";f,'ff'\"")) { |
65 | 66 | Statement stmt = connection.createStatement(); |
66 | 67 | ResultSet rs = stmt.executeQuery("SELECT @@session_track_system_variables"); |
67 | 68 | assertTrue(rs.next()); |
| 69 | + } catch (SQLException e) { |
| 70 | + // in case server check variable validity |
| 71 | + Assertions.assertTrue(e.getCause().getMessage().contains("Unknown system variable 'some\";f'")); |
| 72 | + } |
| 73 | + try (Connection connection = |
| 74 | + createCon("sessionVariables=session_track_system_variables=connect_timeout")) { |
| 75 | + Statement stmt = connection.createStatement(); |
| 76 | + ResultSet rs = stmt.executeQuery("SELECT @@session_track_system_variables"); |
| 77 | + assertTrue(rs.next()); |
68 | 78 | } |
69 | 79 | } |
70 | 80 | } |
|
0 commit comments