@Test public void testFindConnectorLibPath_PostgreSQL() { String path = ConfigHelper.findConnectorLibPath("PostgreSQL"); Assert.assertTrue(path.contains("postgresql")); }
public static String findConnectorLibPath(String dbType) { DbType type = DbType.valueOf(dbType); URL resource = Thread.currentThread().getContextClassLoader().getResource("logback.xml"); _LOG.info("jar resource: {}", resource); if (resource != null) { try { File file = new File(resource.toURI().getRawPath() + "/../lib/" + type.getConnectorJarFile()); return URLDecoder.decode(file.getCanonicalPath(), Charset.forName("UTF-8").displayName()); } catch (Exception e) { throw new RuntimeException("找不到驱动文件，请联系开发者"); } } else { throw new RuntimeException("lib can't find"); } }
ConfigHelper { public static String findConnectorLibPath(String dbType) { DbType type = DbType.valueOf(dbType); URL resource = Thread.currentThread().getContextClassLoader().getResource("logback.xml"); _LOG.info("jar resource: {}", resource); if (resource != null) { try { File file = new File(resource.toURI().getRawPath() + "/../lib/" + type.getConnectorJarFile()); return URLDecoder.decode(file.getCanonicalPath(), Charset.forName("UTF-8").displayName()); } catch (Exception e) { throw new RuntimeException("找不到驱动文件，请联系开发者"); } } else { throw new RuntimeException("lib can't find"); } } }
ConfigHelper { public static String findConnectorLibPath(String dbType) { DbType type = DbType.valueOf(dbType); URL resource = Thread.currentThread().getContextClassLoader().getResource("logback.xml"); _LOG.info("jar resource: {}", resource); if (resource != null) { try { File file = new File(resource.toURI().getRawPath() + "/../lib/" + type.getConnectorJarFile()); return URLDecoder.decode(file.getCanonicalPath(), Charset.forName("UTF-8").displayName()); } catch (Exception e) { throw new RuntimeException("找不到驱动文件，请联系开发者"); } } else { throw new RuntimeException("lib can't find"); } }  }
ConfigHelper { public static String findConnectorLibPath(String dbType) { DbType type = DbType.valueOf(dbType); URL resource = Thread.currentThread().getContextClassLoader().getResource("logback.xml"); _LOG.info("jar resource: {}", resource); if (resource != null) { try { File file = new File(resource.toURI().getRawPath() + "/../lib/" + type.getConnectorJarFile()); return URLDecoder.decode(file.getCanonicalPath(), Charset.forName("UTF-8").displayName()); } catch (Exception e) { throw new RuntimeException("找不到驱动文件，请联系开发者"); } } else { throw new RuntimeException("lib can't find"); } }  static void createEmptyFiles(); static List<DatabaseConfig> loadDatabaseConfig(); static void saveDatabaseConfig(boolean isUpdate, Integer primaryKey, DatabaseConfig dbConfig); static void deleteDatabaseConfig(DatabaseConfig databaseConfig); static void saveGeneratorConfig(GeneratorConfig generatorConfig); static GeneratorConfig loadGeneratorConfig(String name); static List<GeneratorConfig> loadGeneratorConfigs(); static int deleteGeneratorConfig(String name); static String findConnectorLibPath(String dbType); static List<String> getAllJDBCDriverJarPaths(); }
ConfigHelper { public static String findConnectorLibPath(String dbType) { DbType type = DbType.valueOf(dbType); URL resource = Thread.currentThread().getContextClassLoader().getResource("logback.xml"); _LOG.info("jar resource: {}", resource); if (resource != null) { try { File file = new File(resource.toURI().getRawPath() + "/../lib/" + type.getConnectorJarFile()); return URLDecoder.decode(file.getCanonicalPath(), Charset.forName("UTF-8").displayName()); } catch (Exception e) { throw new RuntimeException("找不到驱动文件，请联系开发者"); } } else { throw new RuntimeException("lib can't find"); } }  static void createEmptyFiles(); static List<DatabaseConfig> loadDatabaseConfig(); static void saveDatabaseConfig(boolean isUpdate, Integer primaryKey, DatabaseConfig dbConfig); static void deleteDatabaseConfig(DatabaseConfig databaseConfig); static void saveGeneratorConfig(GeneratorConfig generatorConfig); static GeneratorConfig loadGeneratorConfig(String name); static List<GeneratorConfig> loadGeneratorConfigs(); static int deleteGeneratorConfig(String name); static String findConnectorLibPath(String dbType); static List<String> getAllJDBCDriverJarPaths();  }