OmniSciDB  29e35f4d58
com.omnisci.jdbc.OmniSciConnectionTest Class Reference
+ Collaboration diagram for com.omnisci.jdbc.OmniSciConnectionTest:

Public Member Functions

void tst1_binary_unencrypted ()
 
void tst1a_binary_encrypted_supplied_truststore ()
 
void tst1b_binary_encrypted_default ()
 
void tst1c_binary_encrypted_supplied_truststore_pkiauth_valid ()
 
void tst1e_binary_encrypted_supplied_truststore_pkiauth_invalid ()
 
void tst2_http_unencrypted ()
 
void tst3a_https_encrypted_without_server_validation_default_truststore ()
 
void tst3b_https_encrypted_without_server_validation_supplied_truststore ()
 
void tst3c_https_encrypted_server_validation_default_truststore ()
 
void tst3d_https_encrypted_with_server_validation_supplied_truststore ()
 
void tst3e_https_insecure_encrypted_supplied_truststore_pkiauth_valid ()
 
void tst5_connect ()
 
void tst6_connect ()
 
void tst7_connect ()
 
void tst8_connect ()
 

Static Package Attributes

static Properties PROPERTIES = new Property_loader("connection_test.properties")
 
static final String user = PROPERTIES.getProperty("default_super_user")
 
static final String password = PROPERTIES.getProperty("default_user_password")
 

Detailed Description

Definition at line 14 of file OmniSciConnectionTest.java.

Member Function Documentation

◆ tst1_binary_unencrypted()

void com.omnisci.jdbc.OmniSciConnectionTest.tst1_binary_unencrypted ( )
inline

Definition at line 23 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

23  {
24  try {
25  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
26  + PROPERTIES.getProperty("default_db");
27  Connection conn = DriverManager.getConnection(url, user, password);
28  assertNotEquals(null, conn);
29  conn.close();
30  boolean closed = conn.isClosed();
31  assertEquals(true, closed);
32  } catch (SQLException sq) {
33  String err = "Connection test failed " + sq.toString();
34  fail(err);
35  }
36  }
static unsigned fail
Definition: testing.h:30

◆ tst1a_binary_encrypted_supplied_truststore()

void com.omnisci.jdbc.OmniSciConnectionTest.tst1a_binary_encrypted_supplied_truststore ( )
inline

Definition at line 39 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

39  {
40  try {
41  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
42  + PROPERTIES.getProperty("default_db") + ":binary_tls";
43  String trust_store = PROPERTIES.getProperty("server_trust_store");
44  ClassLoader cl = getClass().getClassLoader();
45  trust_store = cl.getResource(trust_store).getPath();
46  Properties pt = new Properties();
47  pt.setProperty("user", user);
48  pt.setProperty("password", password);
49  pt.setProperty("server_trust_store", trust_store);
50  pt.setProperty("server_trust_store_pwd",
51  PROPERTIES.getProperty("server_trust_store_password"));
52  Connection conn = DriverManager.getConnection(url, pt);
53  assertNotEquals(null, conn);
54  conn.close();
55  boolean closed = conn.isClosed();
56  assertEquals(true, closed);
57  } catch (SQLException sq) {
58  String err = "Connection test failed " + sq.toString();
59  fail(err);
60  }
61  }
static unsigned fail
Definition: testing.h:30

◆ tst1b_binary_encrypted_default()

void com.omnisci.jdbc.OmniSciConnectionTest.tst1b_binary_encrypted_default ( )
inline

Definition at line 64 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

64  {
65  try {
66  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
67  + PROPERTIES.getProperty("default_db") + ":binary_tls";
68 
69  Properties pt = new Properties();
70  pt.setProperty("user", user);
71  pt.setProperty("password", password);
72  Connection conn = DriverManager.getConnection(url, pt);
73  assertNotEquals(null, conn);
74  conn.close();
75  boolean closed = conn.isClosed();
76  assertEquals(true, closed);
77  } catch (SQLException sq) {
78  String err = "Connection test failed " + sq.toString();
79  fail(err);
80  }
81  }
static unsigned fail
Definition: testing.h:30

◆ tst1c_binary_encrypted_supplied_truststore_pkiauth_valid()

void com.omnisci.jdbc.OmniSciConnectionTest.tst1c_binary_encrypted_supplied_truststore_pkiauth_valid ( )
inline

Definition at line 84 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

84  {
85  try {
86  Properties pt = new Properties();
87  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
88  + PROPERTIES.getProperty("default_db") + ":binary_tls";
89 
90  ClassLoader cl = getClass().getClassLoader();
91  String trust_store = PROPERTIES.getProperty("server_trust_store");
92  trust_store = cl.getResource(trust_store).getPath();
93  pt.setProperty("server_trust_store", trust_store);
94 
95  String sslcert_cl1 = PROPERTIES.getProperty("sslcert_cl1_pkcs12");
96  sslcert_cl1 = cl.getResource(sslcert_cl1).getPath();
97  pt.setProperty("sslcert", sslcert_cl1);
98 
99  pt.setProperty("sslkey_password", PROPERTIES.getProperty("sslkey_password_cl1"));
100 
101  pt.setProperty("user", "pki");
102  pt.setProperty("password", "");
103  pt.setProperty("server_trust_store_pwd",
104  PROPERTIES.getProperty("server_trust_store_password"));
105  pt.setProperty("pkiauth", PROPERTIES.getProperty("pkiauth"));
106 
107  Connection conn = DriverManager.getConnection(url, pt);
108  assertNotEquals(null, conn);
109 
110  Statement statement = conn.createStatement();
111  statement.executeUpdate("drop table if exists test_jdbc_tm_tble");
112 
113  conn.close();
114  boolean closed = conn.isClosed();
115  assertEquals(true, closed);
116  } catch (SQLException sq) {
117  String err = "Connection test failed " + sq.toString();
118  fail(err);
119  }
120  }
static unsigned fail
Definition: testing.h:30

◆ tst1e_binary_encrypted_supplied_truststore_pkiauth_invalid()

void com.omnisci.jdbc.OmniSciConnectionTest.tst1e_binary_encrypted_supplied_truststore_pkiauth_invalid ( )
inline

Definition at line 123 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

123  {
124  try {
125  Properties pt = new Properties();
126  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
127  + PROPERTIES.getProperty("default_db") + ":binary_tls";
128 
129  ClassLoader cl = getClass().getClassLoader();
130  String trust_store = PROPERTIES.getProperty("server_trust_store");
131  trust_store = cl.getResource(trust_store).getPath();
132  pt.setProperty("server_trust_store", trust_store);
133 
134  // Connect client 1 whose cert is signed by primary and should work
135  String sslcert_cl2 = PROPERTIES.getProperty("sslcert_cl2");
136  sslcert_cl2 = cl.getResource(sslcert_cl2).getPath();
137  pt.setProperty("sslcert", sslcert_cl2);
138 
139  String sslkey_cl2 = PROPERTIES.getProperty("sslkey_cl2");
140  sslkey_cl2 = cl.getResource(sslkey_cl2).getPath();
141  pt.setProperty("sslkey", sslkey_cl2);
142 
143  pt.setProperty("user", "pki");
144  pt.setProperty("password", "");
145  pt.setProperty("server_trust_store_pwd",
146  PROPERTIES.getProperty("server_trust_store_password"));
147  pt.setProperty("pkiauth", PROPERTIES.getProperty("pkiauth"));
148 
149  Connection conn = DriverManager.getConnection(url, pt);
150  assertNotEquals(null, conn);
151  conn.close();
152  boolean closed = conn.isClosed();
153  fail("Credential should not have been accepted");
154  } catch (SQLException sq) {
155  String err = "Connection test failed " + sq.toString();
156  assertTrue(err.contains("Invalid credentials"));
157  }
158  }
static unsigned fail
Definition: testing.h:30

◆ tst2_http_unencrypted()

void com.omnisci.jdbc.OmniSciConnectionTest.tst2_http_unencrypted ( )
inline

Definition at line 160 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

160  {
161  try {
162  String url = PROPERTIES.getProperty("http_connection_url") + ":"
163  + PROPERTIES.getProperty("default_db") + ":http";
164  Connection conn = DriverManager.getConnection(url, user, password);
165  assertNotEquals(null, conn);
166  conn.close();
167  boolean closed = conn.isClosed();
168  assertEquals(true, closed);
169  } catch (SQLException sq) {
170  String err = "Connection test failed " + sq.toString();
171  fail(err);
172  }
173  }
static unsigned fail
Definition: testing.h:30

◆ tst3a_https_encrypted_without_server_validation_default_truststore()

void com.omnisci.jdbc.OmniSciConnectionTest.tst3a_https_encrypted_without_server_validation_default_truststore ( )
inline

Definition at line 176 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

176  {
177  try {
178  Properties pt = new Properties();
179  pt.setProperty("user", user);
180  pt.setProperty("password", password);
181  pt.setProperty("protocol", "https_insecure");
182  String url = PROPERTIES.getProperty("https_connection_url") + ":"
183  + PROPERTIES.getProperty("default_db");
184  Connection conn = DriverManager.getConnection(url, pt);
185  assertNotEquals(null, conn);
186  conn.close();
187  boolean closed = conn.isClosed();
188  assertEquals(true, closed);
189  } catch (SQLException sq) {
190  String err = "Connection test failed " + sq.toString();
191  fail(err);
192  }
193  }
static unsigned fail
Definition: testing.h:30

◆ tst3b_https_encrypted_without_server_validation_supplied_truststore()

void com.omnisci.jdbc.OmniSciConnectionTest.tst3b_https_encrypted_without_server_validation_supplied_truststore ( )
inline

Definition at line 196 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

196  {
197  try {
198  ClassLoader cl = getClass().getClassLoader();
199  String trust_store = PROPERTIES.getProperty("server_trust_store");
200  trust_store = cl.getResource(trust_store).getPath();
201 
202  Properties pt = new Properties();
203  pt.setProperty("server_trust_store", trust_store);
204  pt.setProperty("server_trust_store_pwd",
205  PROPERTIES.getProperty("server_trust_store_password"));
206 
207  pt.setProperty("user", user);
208  pt.setProperty("password", password);
209  pt.setProperty("protocol", "https_insecure");
210 
211  String url = PROPERTIES.getProperty("https_connection_url") + ":"
212  + PROPERTIES.getProperty("default_db");
213  Connection conn = DriverManager.getConnection(url, pt);
214  assertNotEquals(null, conn);
215  conn.close();
216  boolean closed = conn.isClosed();
217  assertEquals(true, closed);
218  } catch (SQLException sq) {
219  String err = "Connection test failed " + sq.toString();
220  fail(err);
221  }
222  }
static unsigned fail
Definition: testing.h:30

◆ tst3c_https_encrypted_server_validation_default_truststore()

void com.omnisci.jdbc.OmniSciConnectionTest.tst3c_https_encrypted_server_validation_default_truststore ( )
inline

Definition at line 225 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

225  {
226  try {
227  Properties pt = new Properties();
228  pt.setProperty("user", user);
229  pt.setProperty("password", password);
230  pt.setProperty("protocol", "https");
231  String url = PROPERTIES.getProperty("https_connection_url") + ":"
232  + PROPERTIES.getProperty("default_db");
233  Connection conn = DriverManager.getConnection(url, pt);
234  assertNotEquals(null, conn);
235  conn.close();
236  boolean closed = conn.isClosed();
237  assertEquals(true, closed);
238  } catch (SQLException sq) {
239  String err = "Connection test failed " + sq.toString();
240  fail(err);
241  }
242  }
static unsigned fail
Definition: testing.h:30

◆ tst3d_https_encrypted_with_server_validation_supplied_truststore()

void com.omnisci.jdbc.OmniSciConnectionTest.tst3d_https_encrypted_with_server_validation_supplied_truststore ( )
inline

Definition at line 245 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

245  {
246  try {
247  ClassLoader cl = getClass().getClassLoader();
248  String trust_store = PROPERTIES.getProperty("ca_primary_trust_store");
249  trust_store = cl.getResource(trust_store).getPath();
250  Properties pt = new Properties();
251  pt.setProperty("server_trust_store", trust_store);
252  pt.setProperty("server_trust_store_pwd",
253  PROPERTIES.getProperty("server_trust_store_password"));
254 
255  pt.setProperty("user", user);
256  pt.setProperty("password", password);
257  pt.setProperty("protocol", "https");
258 
259  String url = PROPERTIES.getProperty("https_connection_url") + ":"
260  + PROPERTIES.getProperty("default_db");
261 
262  Connection conn = DriverManager.getConnection(url, pt);
263  conn.close();
264  assertNotEquals(null, conn);
265  boolean closed = conn.isClosed();
266  assertEquals(true, closed);
267 
268  assertNotEquals(null, conn);
269  } catch (SQLException sq) {
270  String err = "Connection test failed " + sq.toString();
271  fail(err);
272  }
273  }
static unsigned fail
Definition: testing.h:30

◆ tst3e_https_insecure_encrypted_supplied_truststore_pkiauth_valid()

void com.omnisci.jdbc.OmniSciConnectionTest.tst3e_https_insecure_encrypted_supplied_truststore_pkiauth_valid ( )
inline

Definition at line 275 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

275  {
276  try {
277  Properties pt = new Properties();
278  String url = PROPERTIES.getProperty("https_connection_url") + ":"
279  + PROPERTIES.getProperty("default_db") + ":https_insecure";
280 
281  ClassLoader cl = getClass().getClassLoader();
282  String trust_store = PROPERTIES.getProperty("server_trust_store");
283  trust_store = cl.getResource(trust_store).getPath();
284  pt.setProperty("server_trust_store", trust_store);
285 
286  String sslcert_cl1 = PROPERTIES.getProperty("sslcert_cl1_pkcs12");
287  sslcert_cl1 = cl.getResource(sslcert_cl1).getPath();
288  pt.setProperty("sslcert", sslcert_cl1);
289 
290  pt.setProperty("sslkey_password", PROPERTIES.getProperty("sslkey_password_cl1"));
291 
292  pt.setProperty("user", "pki");
293  pt.setProperty("password", "");
294  pt.setProperty("server_trust_store_pwd",
295  PROPERTIES.getProperty("server_trust_store_password"));
296  pt.setProperty("pkiauth", PROPERTIES.getProperty("pkiauth"));
297 
298  Connection conn = DriverManager.getConnection(url, pt);
299  Statement statement = conn.createStatement();
300  statement.executeUpdate("drop table if exists test_jdbc_tm_tble");
301  assertNotEquals(null, conn);
302  conn.close();
303  boolean closed = conn.isClosed();
304  assertEquals(true, closed);
305  } catch (SQLException sq) {
306  String err = "Connection test failed " + sq.toString();
307  fail(err);
308  }
309  }
static unsigned fail
Definition: testing.h:30

◆ tst5_connect()

void com.omnisci.jdbc.OmniSciConnectionTest.tst5_connect ( )
inline

Definition at line 312 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

312  {
313  try {
314  String url = PROPERTIES.getProperty("failed_connection_url") + ":"
315  + PROPERTIES.getProperty("default_db");
316  Properties pt = new Properties();
317  pt.setProperty("user", user);
318  pt.setProperty("password", password);
319  Connection conn = DriverManager.getConnection(url, pt);
320  } catch (SQLException sq) {
321  assertEquals(sq.getMessage(),
322  "No suitable driver found for jdbc:NOT_omnisci:localhost:6274:omnisci");
323  return;
324  }
325  String err = "Connection should have thrown";
326  fail(err);
327  }
static unsigned fail
Definition: testing.h:30

◆ tst6_connect()

void com.omnisci.jdbc.OmniSciConnectionTest.tst6_connect ( )
inline

Definition at line 330 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

330  {
331  try {
332  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
333  + PROPERTIES.getProperty("default_db");
334  Properties pt = new Properties();
335  pt.setProperty("user", user);
336  pt.setProperty("password", password);
337  pt.setProperty("db_name", "omnisci");
338  Connection conn = DriverManager.getConnection(url, pt);
339  } catch (SQLException sq) {
340  fail(sq.getMessage());
341  }
342  }
static unsigned fail
Definition: testing.h:30

◆ tst7_connect()

void com.omnisci.jdbc.OmniSciConnectionTest.tst7_connect ( )
inline

Definition at line 345 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

345  {
346  try {
347  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
348  + PROPERTIES.getProperty("default_db");
349  Properties pt = new Properties();
350  pt.setProperty("user", user);
351  pt.setProperty("password", password);
352  pt.setProperty("db_name", "SomeOtherDB");
353  // Shouldn't fail (url over ride properties.
354  Connection conn = DriverManager.getConnection(url, pt);
355  } catch (SQLException sq) {
356  fail(sq.getMessage());
357  }
358  }
static unsigned fail
Definition: testing.h:30

◆ tst8_connect()

void com.omnisci.jdbc.OmniSciConnectionTest.tst8_connect ( )
inline

Definition at line 361 of file OmniSciConnectionTest.java.

References Testing.fail, and Experimental.String.

361  {
362  try {
363  String url = PROPERTIES.getProperty("default_mapd_connection_url") + ":"
364  + PROPERTIES.getProperty("default_db");
365  Properties pt = new Properties();
366  pt.setProperty("user", user);
367  pt.setProperty("password", password);
368  pt.setProperty("db_name", "SomeOtherDB");
369  // Shouldn't fail (url over ride properties.
370  Connection conn = DriverManager.getConnection(url, pt);
371  } catch (SQLException sq) {
372  fail(sq.getMessage());
373  }
374  }
static unsigned fail
Definition: testing.h:30

Member Data Documentation

◆ password

final String com.omnisci.jdbc.OmniSciConnectionTest.password = PROPERTIES.getProperty("default_user_password")
staticpackage

Definition at line 18 of file OmniSciConnectionTest.java.

◆ PROPERTIES

Properties com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES = new Property_loader("connection_test.properties")
staticpackage

Definition at line 16 of file OmniSciConnectionTest.java.

◆ user

final String com.omnisci.jdbc.OmniSciConnectionTest.user = PROPERTIES.getProperty("default_super_user")
staticpackage

Definition at line 17 of file OmniSciConnectionTest.java.


The documentation for this class was generated from the following file: