comparison artifacts/src/main/java/org/dive4elements/river/utils/MapUtils.java @ 9671:9cfc495a9f40 3.2.x

Add minimal test coverage for MapServer connection generation
author Tom Gottfried <tom@intevation.de>
date Fri, 22 May 2020 19:45:08 +0200
parents 07d854c325d8
children b70b1bc0eece
comparison
equal deleted inserted replaced
9670:07d854c325d8 9671:9cfc495a9f40
36 36
37 String user = SessionFactoryProvider.getUser(sf); 37 String user = SessionFactoryProvider.getUser(sf);
38 String pass = SessionFactoryProvider.getPass(sf); 38 String pass = SessionFactoryProvider.getPass(sf);
39 String url = SessionFactoryProvider.getURL(sf); 39 String url = SessionFactoryProvider.getURL(sf);
40 40
41 return getConnection(user, pass, url);
42 }
43
44 public static String getConnection(String user, String pass, String url) {
41 log.debug("Parse connection url: " + url); 45 log.debug("Parse connection url: " + url);
42 46
43 Matcher m = DB_URL_PATTERN.matcher(url); 47 Matcher m = DB_URL_PATTERN.matcher(url);
44 if (!m.matches()) { 48 if (!m.matches()) {
45 log.warn("Could not parse Connection string"); 49 log.warn("Could not parse Connection string");
63 67
64 String host = m.group(2); 68 String host = m.group(2);
65 String port = m.group(3); 69 String port = m.group(3);
66 String db = m.group(4); 70 String db = m.group(4);
67 71
68 if (RiverUtils.isUsingOracle()) { 72 if (url.startsWith("jdbc:oracle:")) {
69 connection = user + "/" + pass 73 connection = user + "/" + pass
70 + "@" + host + ":" + port + "/" + db; 74 + "@" + host + ":" + port + "/" + db;
71 } 75 }
72 else { 76 else {
73 connection = createConnectionString(user, pass, host, db, port); 77 connection = createConnectionString(user, pass, host, db, port);

http://dive4elements.wald.intevation.org