OmniSciDB  85c2d10cdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.omnisci.jdbc.OmniSciConnectionTest Class Reference
+ Collaboration diagram for com.omnisci.jdbc.OmniSciConnectionTest:

Public Member Functions

void tst1_binary_unencrypted ()
 
void tst1_binary_unencrypted_query_url1 ()
 
void tst1_binary_unencrypted_query_url2 ()
 
void tst1_binary_unencrypted_query_url3 ()
 
void tst1_binary_unencrypted_query_url4 ()
 
void tst1_binary_unencrypted_query_url5 ()
 
void tst1_url_too_long ()
 
void tst2_http_unencrypted ()
 
void tst3_connect_fail ()
 
void tst4_connect_url_override ()
 
void tst5_properties_connection ()
 
void tst1b_binary_encrypted_default ()
 
void tst1c_binary_encrypted_supplied_truststore_pkiauth_valid ()
 
void tst1e_binary_encrypted_supplied_truststore_pkiauth_invalid ()
 
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 ()
 

Static Public Member Functions

static void setUpBeforeClass () throws Exception
 

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")
 
static Properties base_properties
 

Detailed Description

Definition at line 18 of file OmniSciConnectionTest.java.

Member Function Documentation

static void com.omnisci.jdbc.OmniSciConnectionTest.setUpBeforeClass ( ) throws Exception
inlinestatic

Definition at line 26 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.base_properties.

26  {
27  String fileName = System.getProperty("propertiesFileName");
28  base_properties = new Properties();
29  if (fileName == null || fileName.equals("")) {
30  return;
31  }
32  File initialFile = new File(fileName);
33  InputStream inputStream = new FileInputStream(initialFile);
34  base_properties.load(inputStream);
35  }
void com.omnisci.jdbc.OmniSciConnectionTest.tst1_binary_unencrypted ( )
inline

Definition at line 38 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

38  {
39  try {
40  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
41  + PROPERTIES.getProperty("default_db");
42  Connection conn = DriverManager.getConnection(url, user, password);
43  assertNotEquals(null, conn);
44  conn.close();
45  boolean closed = conn.isClosed();
46  assertEquals(true, closed);
47  } catch (SQLException sq) {
48  String err = "Connection test failed " + sq.toString();
49  fail(err);
50  }
51  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1_binary_unencrypted_query_url1 ( )
inline

Definition at line 54 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

54  {
55  String url = null;
56  try {
57  url = PROPERTIES.getProperty("query_connection_url1");
58  Connection conn = DriverManager.getConnection(url, user, password);
59  assertNotEquals(null, conn);
60  conn.close();
61  boolean closed = conn.isClosed();
62  assertEquals(true, closed);
63 
64  } catch (SQLException sq) {
65  String err = "Connection test failed for url " + url + ":" + sq.toString();
66  fail(err);
67  }
68  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1_binary_unencrypted_query_url2 ( )
inline

Definition at line 70 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

70  {
71  String url = null;
72  url = PROPERTIES.getProperty("query_connection_url2");
73  try {
74  Connection conn = DriverManager.getConnection(url, user, password);
75  } catch (SQLException re) {
76  assertEquals(re.getMessage(), "Invalid value supplied for max rows XXX");
77  }
78  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1_binary_unencrypted_query_url3 ( )
inline

Definition at line 80 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

80  {
81  String url = null;
82  try {
83  url = PROPERTIES.getProperty("query_connection_url3");
84  Connection conn = DriverManager.getConnection(url, user, password);
85  assertNotEquals(null, conn);
86  conn.close();
87  boolean closed = conn.isClosed();
88  assertEquals(true, closed);
89 
90  } catch (SQLException sq) {
91  String err = "Connection test failed for url " + url + ":" + sq.toString();
92  fail(err);
93  }
94  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1_binary_unencrypted_query_url4 ( )
inline

Definition at line 97 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

97  {
98  String url = null;
99  try {
100  url = PROPERTIES.getProperty("query_connection_url4");
101  Connection conn = DriverManager.getConnection(url, user, password);
102  assertNotEquals(null, conn);
103  conn.close();
104  boolean closed = conn.isClosed();
105  assertEquals(true, closed);
106 
107  } catch (SQLException sq) {
108  String err = "Connection test failed for url " + url + ":" + sq.toString();
109  fail(err);
110  }
111  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1_binary_unencrypted_query_url5 ( )
inline

Definition at line 114 of file OmniSciConnectionTest.java.

References setup.url.

114  {
115  String url = null;
116  try {
117  url = PROPERTIES.getProperty("query_connection_url5");
118  Connection conn = DriverManager.getConnection(url);
119  assertNotEquals(null, conn);
120  conn.close();
121  boolean closed = conn.isClosed();
122  assertEquals(true, closed);
123 
124  } catch (SQLException sq) {
125  String err = "Connection test failed for url " + url + ":" + sq.toString();
126  fail(err);
127  }
128  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1_url_too_long ( )
inline

Definition at line 130 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

130  {
131  try {
132  String url = "jdbc:omnisci:l3:6666:l5:l6:l7:l8:l9:l10:l11:l12:50000:l14:l15";
133  Connection conn = DriverManager.getConnection(url, user, password);
134  } catch (SQLException sq) {
135  assertEquals(sq.getMessage(),
136  "Invalid number of arguments provided in url [15]. Maximum allowed [13]");
137  }
138  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1b_binary_encrypted_default ( )
inline

Definition at line 204 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

204  {
205  try {
206  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
207  + PROPERTIES.getProperty("default_db") + ":binary_tls";
208 
209  Properties pt = new Properties();
210  pt.setProperty("user", user);
211  pt.setProperty("password", password);
212  Connection conn = DriverManager.getConnection(url, pt);
213  assertNotEquals(null, conn);
214  conn.close();
215  boolean closed = conn.isClosed();
216  assertEquals(true, closed);
217  } catch (SQLException sq) {
218  String err = "Connection test failed " + sq.toString();
219  fail(err);
220  }
221  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1c_binary_encrypted_supplied_truststore_pkiauth_valid ( )
inline

Definition at line 224 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, and setup.url.

224  {
225  try {
226  Properties pt = new Properties();
227  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
228  + PROPERTIES.getProperty("default_db") + ":binary_tls";
229 
230  ClassLoader cl = getClass().getClassLoader();
231  String trust_store = PROPERTIES.getProperty("server_trust_store");
232  trust_store = cl.getResource(trust_store).getPath();
233  pt.setProperty("server_trust_store", trust_store);
234 
235  String sslcert_cl1 = PROPERTIES.getProperty("sslcert_cl1_pkcs12");
236  sslcert_cl1 = cl.getResource(sslcert_cl1).getPath();
237  pt.setProperty("sslcert", sslcert_cl1);
238 
239  pt.setProperty("sslkey_password", PROPERTIES.getProperty("sslkey_password_cl1"));
240 
241  pt.setProperty("user", "pki");
242  pt.setProperty("password", "");
243  pt.setProperty("server_trust_store_pwd",
244  PROPERTIES.getProperty("server_trust_store_password"));
245  pt.setProperty("pkiauth", PROPERTIES.getProperty("pkiauth"));
246 
247  Connection conn = DriverManager.getConnection(url, pt);
248  assertNotEquals(null, conn);
249 
250  Statement statement = conn.createStatement();
251  statement.executeUpdate("drop table if exists test_jdbc_tm_tble");
252 
253  conn.close();
254  boolean closed = conn.isClosed();
255  assertEquals(true, closed);
256  } catch (SQLException sq) {
257  String err = "Connection test failed " + sq.toString();
258  fail(err);
259  }
260  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst1e_binary_encrypted_supplied_truststore_pkiauth_invalid ( )
inline

Definition at line 263 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, and setup.url.

263  {
264  try {
265  Properties pt = new Properties();
266  String url = PROPERTIES.getProperty("binary_connection_url") + ":"
267  + PROPERTIES.getProperty("default_db") + ":binary_tls";
268 
269  ClassLoader cl = getClass().getClassLoader();
270  String trust_store = PROPERTIES.getProperty("server_trust_store");
271  trust_store = cl.getResource(trust_store).getPath();
272  pt.setProperty("server_trust_store", trust_store);
273 
274  // Connect client 1 whose cert is signed by primary and should work
275  String sslcert_cl2 = PROPERTIES.getProperty("sslcert_cl2");
276  sslcert_cl2 = cl.getResource(sslcert_cl2).getPath();
277  pt.setProperty("sslcert", sslcert_cl2);
278 
279  String sslkey_cl2 = PROPERTIES.getProperty("sslkey_cl2");
280  sslkey_cl2 = cl.getResource(sslkey_cl2).getPath();
281  pt.setProperty("sslkey", sslkey_cl2);
282 
283  pt.setProperty("user", "pki");
284  pt.setProperty("password", "");
285  pt.setProperty("server_trust_store_pwd",
286  PROPERTIES.getProperty("server_trust_store_password"));
287  pt.setProperty("pkiauth", PROPERTIES.getProperty("pkiauth"));
288 
289  Connection conn = DriverManager.getConnection(url, pt);
290  assertNotEquals(null, conn);
291  conn.close();
292  boolean closed = conn.isClosed();
293  fail("Credential should not have been accepted");
294  } catch (SQLException sq) {
295  String err = "Connection test failed " + sq.toString();
296  assertTrue(err.contains("Invalid credentials"));
297  }
298  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst2_http_unencrypted ( )
inline

Definition at line 140 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

140  {
141  try {
142  String url = PROPERTIES.getProperty("http_connection_url") + ":"
143  + PROPERTIES.getProperty("default_db") + ":http";
144  Connection conn = DriverManager.getConnection(url, user, password);
145  assertNotEquals(null, conn);
146  conn.close();
147  boolean closed = conn.isClosed();
148  assertEquals(true, closed);
149  } catch (SQLException sq) {
150  String err = "Connection test failed " + sq.toString();
151  fail(err);
152  }
153  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst3_connect_fail ( )
inline

Definition at line 155 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

155  {
156  try {
157  String url = PROPERTIES.getProperty("failed_connection_url") + ":"
158  + PROPERTIES.getProperty("default_db");
159  Properties pt = new Properties();
160  pt.setProperty("user", user);
161  pt.setProperty("password", password);
162  Connection conn = DriverManager.getConnection(url, pt);
163  } catch (SQLException sq) {
164  assertEquals(sq.getMessage(),
165  "No suitable driver found for jdbc:NOT_omnisci:localhost:6274:omnisci");
166  return;
167  }
168  String err = "Connection should have thrown";
169  fail(err);
170  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst3a_https_encrypted_without_server_validation_default_truststore ( )
inline

Definition at line 301 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

301  {
302  try {
303  Properties pt = new Properties();
304  pt.setProperty("user", user);
305  pt.setProperty("password", password);
306  pt.setProperty("protocol", "https_insecure");
307  String url = PROPERTIES.getProperty("https_connection_url") + ":"
308  + PROPERTIES.getProperty("default_db");
309  Connection conn = DriverManager.getConnection(url, pt);
310  assertNotEquals(null, conn);
311  conn.close();
312  boolean closed = conn.isClosed();
313  assertEquals(true, closed);
314  } catch (SQLException sq) {
315  String err = "Connection test failed " + sq.toString();
316  fail(err);
317  }
318  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst3b_https_encrypted_without_server_validation_supplied_truststore ( )
inline

Definition at line 321 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

321  {
322  try {
323  ClassLoader cl = getClass().getClassLoader();
324  String trust_store = PROPERTIES.getProperty("server_trust_store");
325  trust_store = cl.getResource(trust_store).getPath();
326 
327  Properties pt = new Properties();
328  pt.setProperty("server_trust_store", trust_store);
329  pt.setProperty("server_trust_store_pwd",
330  PROPERTIES.getProperty("server_trust_store_password"));
331 
332  pt.setProperty("user", user);
333  pt.setProperty("password", password);
334  pt.setProperty("protocol", "https_insecure");
335 
336  String url = PROPERTIES.getProperty("https_connection_url") + ":"
337  + PROPERTIES.getProperty("default_db");
338  Connection conn = DriverManager.getConnection(url, pt);
339  assertNotEquals(null, conn);
340  conn.close();
341  boolean closed = conn.isClosed();
342  assertEquals(true, closed);
343  } catch (SQLException sq) {
344  String err = "Connection test failed " + sq.toString();
345  fail(err);
346  }
347  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst3c_https_encrypted_server_validation_default_truststore ( )
inline

Definition at line 350 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

350  {
351  try {
352  Properties pt = new Properties();
353  pt.setProperty("user", user);
354  pt.setProperty("password", password);
355  pt.setProperty("protocol", "https");
356  String url = PROPERTIES.getProperty("https_connection_url") + ":"
357  + PROPERTIES.getProperty("default_db");
358  Connection conn = DriverManager.getConnection(url, pt);
359  assertNotEquals(null, conn);
360  conn.close();
361  boolean closed = conn.isClosed();
362  assertEquals(true, closed);
363  } catch (SQLException sq) {
364  String err = "Connection test failed " + sq.toString();
365  fail(err);
366  }
367  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst3d_https_encrypted_with_server_validation_supplied_truststore ( )
inline

Definition at line 370 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

370  {
371  try {
372  ClassLoader cl = getClass().getClassLoader();
373  String trust_store = PROPERTIES.getProperty("ca_primary_trust_store");
374  trust_store = cl.getResource(trust_store).getPath();
375  Properties pt = new Properties();
376  pt.setProperty("server_trust_store", trust_store);
377  pt.setProperty("server_trust_store_pwd",
378  PROPERTIES.getProperty("server_trust_store_password"));
379 
380  pt.setProperty("user", user);
381  pt.setProperty("password", password);
382  pt.setProperty("protocol", "https");
383 
384  String url = PROPERTIES.getProperty("https_connection_url") + ":"
385  + PROPERTIES.getProperty("default_db");
386 
387  Connection conn = DriverManager.getConnection(url, pt);
388  conn.close();
389  assertNotEquals(null, conn);
390  boolean closed = conn.isClosed();
391  assertEquals(true, closed);
392 
393  assertNotEquals(null, conn);
394  } catch (SQLException sq) {
395  String err = "Connection test failed " + sq.toString();
396  fail(err);
397  }
398  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst3e_https_insecure_encrypted_supplied_truststore_pkiauth_valid ( )
inline

Definition at line 400 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, and setup.url.

400  {
401  try {
402  Properties pt = new Properties();
403  String url = PROPERTIES.getProperty("https_connection_url") + ":"
404  + PROPERTIES.getProperty("default_db") + ":https_insecure";
405 
406  ClassLoader cl = getClass().getClassLoader();
407  String trust_store = PROPERTIES.getProperty("server_trust_store");
408  trust_store = cl.getResource(trust_store).getPath();
409  pt.setProperty("server_trust_store", trust_store);
410 
411  String sslcert_cl1 = PROPERTIES.getProperty("sslcert_cl1_pkcs12");
412  sslcert_cl1 = cl.getResource(sslcert_cl1).getPath();
413  pt.setProperty("sslcert", sslcert_cl1);
414 
415  pt.setProperty("sslkey_password", PROPERTIES.getProperty("sslkey_password_cl1"));
416 
417  pt.setProperty("user", "pki");
418  pt.setProperty("password", "");
419  pt.setProperty("server_trust_store_pwd",
420  PROPERTIES.getProperty("server_trust_store_password"));
421  pt.setProperty("pkiauth", PROPERTIES.getProperty("pkiauth"));
422 
423  Connection conn = DriverManager.getConnection(url, pt);
424  Statement statement = conn.createStatement();
425  statement.executeUpdate("drop table if exists test_jdbc_tm_tble");
426  assertNotEquals(null, conn);
427  conn.close();
428  boolean closed = conn.isClosed();
429  assertEquals(true, closed);
430  } catch (SQLException sq) {
431  String err = "Connection test failed " + sq.toString();
432  fail(err);
433  }
434  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst4_connect_url_override ( )
inline

Definition at line 173 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.password, com.omnisci.jdbc.OmniSciConnectionTest.PROPERTIES, setup.url, and com.omnisci.jdbc.OmniSciConnectionTest.user.

173  {
174  try {
175  String url = PROPERTIES.getProperty("default_mapd_connection_url") + ":"
176  + PROPERTIES.getProperty("default_db");
177  Properties pt = new Properties();
178  pt.setProperty("user", user);
179  pt.setProperty("password", password);
180  pt.setProperty("db_name", "SomeOtherDB");
181  // Shouldn't fail (url over ride properties.
182  Connection conn = DriverManager.getConnection(url, pt);
183  } catch (SQLException sq) {
184  fail(sq.getMessage());
185  }
186  }
string url
Definition: setup.py:48
void com.omnisci.jdbc.OmniSciConnectionTest.tst5_properties_connection ( )
inline

Definition at line 189 of file OmniSciConnectionTest.java.

References com.omnisci.jdbc.OmniSciConnectionTest.base_properties, and setup.url.

189  {
190  try {
191  String url = "jdbc:omnisci:" + base_properties.getProperty("host_name");
192  Connection conn = DriverManager.getConnection(url, base_properties);
193  assertNotEquals(null, conn);
194  conn.close();
195  boolean closed = conn.isClosed();
196  assertEquals(true, closed);
197  } catch (SQLException sq) {
198  String err = "Connection test failed " + sq.toString();
199  fail(err);
200  }
201  }
string url
Definition: setup.py:48

Member Data Documentation

Properties com.omnisci.jdbc.OmniSciConnectionTest.base_properties
staticpackage

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