File tree 2 files changed +21
-6
lines changed
clickhouse-client/src/main/java/com/clickhouse/client/config
jdbc-v2/src/test/java/com/clickhouse/jdbc/metadata
2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -532,7 +532,17 @@ public static String readVersionFromResource(String resourceFilePath) {
532
532
tmpVersion = tmp ;
533
533
}
534
534
} catch (Exception e ) {
535
- // ignore
535
+ try (InputStream in = ClickHouseClientOption .class .getClassLoader ().getResourceAsStream (resourceFilePath )) {
536
+ Properties p = new Properties ();
537
+ p .load (in );
538
+
539
+ String tmp = p .getProperty ("version" );
540
+ if (tmp != null && !tmp .isEmpty () && !tmp .equals ("${revision}" )) {
541
+ tmpVersion = tmp ;
542
+ }
543
+ } catch (Exception ee ) {
544
+ // ignore
545
+ }
536
546
}
537
547
return tmpVersion ;
538
548
}
Original file line number Diff line number Diff line change 24
24
import java .util .Properties ;
25
25
import java .util .Set ;
26
26
27
- import static org .testng .Assert .assertEquals ;
28
- import static org .testng .Assert .assertFalse ;
29
- import static org .testng .Assert .assertNull ;
30
- import static org .testng .Assert .assertTrue ;
31
-
27
+ import static org .testng .Assert .*;
32
28
33
29
34
30
public class DatabaseMetaDataTest extends JdbcIntegrationTest {
@@ -315,4 +311,13 @@ public void testGetClientInfoProperties() throws Exception {
315
311
}
316
312
}
317
313
}
314
+
315
+ @ Test (groups = { "integration" })
316
+ public void testGetDriverVersion () throws Exception {
317
+ try (Connection conn = getJdbcConnection ()) {
318
+ DatabaseMetaData dbmd = conn .getMetaData ();
319
+ String version = dbmd .getDriverVersion ();
320
+ assertNotEquals (version , "unknown" );
321
+ }
322
+ }
318
323
}
You can’t perform that action at this time.
0 commit comments