@Test public void findServerPageListTest() { Assert.assertTrue(setupDataBaseService.connectionTest(connectionRequest).getCode() == ServiceResult.SUCCESS); }
public ServiceResult connectionTest(ConnectionRequest connectionRequest) { Connection conn = null; ResultSet rs = null; try { conn = DataSourceUtil.getConnection(connectionRequest.getDb_address(), connectionRequest.getDb_port(), connectionRequest.getDb_user(), DasEnv.encdecConfiguration.decrypt(connectionRequest.getDb_password()), DataBaseEnum.getDataBaseEnumByType(connectionRequest.getDb_type()).getDriver()); rs = conn.getMetaData().getCatalogs(); Set<String> allCatalog = new HashSet<>(); while (rs.next()) { allCatalog.add(rs.getString("TABLE_CAT")); } return ServiceResult.success(allCatalog); } catch (Throwable e) { log.error(e.getMessage()); return ServiceResult.fail(e.getMessage()); } finally { DbUtil.close(rs); DbUtil.close(conn); } }
SetupDataBaseService { public ServiceResult connectionTest(ConnectionRequest connectionRequest) { Connection conn = null; ResultSet rs = null; try { conn = DataSourceUtil.getConnection(connectionRequest.getDb_address(), connectionRequest.getDb_port(), connectionRequest.getDb_user(), DasEnv.encdecConfiguration.decrypt(connectionRequest.getDb_password()), DataBaseEnum.getDataBaseEnumByType(connectionRequest.getDb_type()).getDriver()); rs = conn.getMetaData().getCatalogs(); Set<String> allCatalog = new HashSet<>(); while (rs.next()) { allCatalog.add(rs.getString("TABLE_CAT")); } return ServiceResult.success(allCatalog); } catch (Throwable e) { log.error(e.getMessage()); return ServiceResult.fail(e.getMessage()); } finally { DbUtil.close(rs); DbUtil.close(conn); } } }
SetupDataBaseService { public ServiceResult connectionTest(ConnectionRequest connectionRequest) { Connection conn = null; ResultSet rs = null; try { conn = DataSourceUtil.getConnection(connectionRequest.getDb_address(), connectionRequest.getDb_port(), connectionRequest.getDb_user(), DasEnv.encdecConfiguration.decrypt(connectionRequest.getDb_password()), DataBaseEnum.getDataBaseEnumByType(connectionRequest.getDb_type()).getDriver()); rs = conn.getMetaData().getCatalogs(); Set<String> allCatalog = new HashSet<>(); while (rs.next()) { allCatalog.add(rs.getString("TABLE_CAT")); } return ServiceResult.success(allCatalog); } catch (Throwable e) { log.error(e.getMessage()); return ServiceResult.fail(e.getMessage()); } finally { DbUtil.close(rs); DbUtil.close(conn); } }  }
SetupDataBaseService { public ServiceResult connectionTest(ConnectionRequest connectionRequest) { Connection conn = null; ResultSet rs = null; try { conn = DataSourceUtil.getConnection(connectionRequest.getDb_address(), connectionRequest.getDb_port(), connectionRequest.getDb_user(), DasEnv.encdecConfiguration.decrypt(connectionRequest.getDb_password()), DataBaseEnum.getDataBaseEnumByType(connectionRequest.getDb_type()).getDriver()); rs = conn.getMetaData().getCatalogs(); Set<String> allCatalog = new HashSet<>(); while (rs.next()) { allCatalog.add(rs.getString("TABLE_CAT")); } return ServiceResult.success(allCatalog); } catch (Throwable e) { log.error(e.getMessage()); return ServiceResult.fail(e.getMessage()); } finally { DbUtil.close(rs); DbUtil.close(conn); } }  ServiceResult connectionTest(ConnectionRequest connectionRequest); boolean tableConsistent(String catalog); boolean setupAdmin(DasGroup dasGroup, LoginUser user); boolean isDalInitialized(); }
SetupDataBaseService { public ServiceResult connectionTest(ConnectionRequest connectionRequest) { Connection conn = null; ResultSet rs = null; try { conn = DataSourceUtil.getConnection(connectionRequest.getDb_address(), connectionRequest.getDb_port(), connectionRequest.getDb_user(), DasEnv.encdecConfiguration.decrypt(connectionRequest.getDb_password()), DataBaseEnum.getDataBaseEnumByType(connectionRequest.getDb_type()).getDriver()); rs = conn.getMetaData().getCatalogs(); Set<String> allCatalog = new HashSet<>(); while (rs.next()) { allCatalog.add(rs.getString("TABLE_CAT")); } return ServiceResult.success(allCatalog); } catch (Throwable e) { log.error(e.getMessage()); return ServiceResult.fail(e.getMessage()); } finally { DbUtil.close(rs); DbUtil.close(conn); } }  ServiceResult connectionTest(ConnectionRequest connectionRequest); boolean tableConsistent(String catalog); boolean setupAdmin(DasGroup dasGroup, LoginUser user); boolean isDalInitialized(); static final Object LOCK; final static String DATASOURCE_MYSQL_DRIVER; final static String jdbcUrlTemplate; }