@Test public void testDataSourceNameBlank() { final String ds0Url = "www.baidu.com"; final String ds0BasePackage = "com.guosen.zebra.ping"; new Expectations() { { OperateProperties.getStrValue("zebra.database.url[0]", StringUtils.EMPTY); result = ds0Url; } { OperateProperties.getStrValue("zebra.database.basePackage[0]", StringUtils.EMPTY); result = ds0BasePackage; } { OperateProperties.getStrValue("zebra.database.dataSourceName[0]", StringUtils.EMPTY); result = StringUtils.EMPTY; } }; try { DataSourceCfgUtil.getDataSourceCfgList(); fail("Must have exception."); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), equalTo("zebra.database.dataSourceName[0] must be config.")); } }
public static List<DataSourceCfg> getDataSourceCfgList() { List<DataSourceCfg> dataSourceCfgList = new ArrayList<>(MAX_DATA_SOURCE_COUNT); for (int i = 0; i < MAX_DATA_SOURCE_COUNT; i++) { DataSourceCfg dataSourceCfg = getDataSourceCfg(i); if (dataSourceCfg == null) { break; } dataSourceCfgList.add(dataSourceCfg); } return dataSourceCfgList; }
DataSourceCfgUtil { public static List<DataSourceCfg> getDataSourceCfgList() { List<DataSourceCfg> dataSourceCfgList = new ArrayList<>(MAX_DATA_SOURCE_COUNT); for (int i = 0; i < MAX_DATA_SOURCE_COUNT; i++) { DataSourceCfg dataSourceCfg = getDataSourceCfg(i); if (dataSourceCfg == null) { break; } dataSourceCfgList.add(dataSourceCfg); } return dataSourceCfgList; } }
DataSourceCfgUtil { public static List<DataSourceCfg> getDataSourceCfgList() { List<DataSourceCfg> dataSourceCfgList = new ArrayList<>(MAX_DATA_SOURCE_COUNT); for (int i = 0; i < MAX_DATA_SOURCE_COUNT; i++) { DataSourceCfg dataSourceCfg = getDataSourceCfg(i); if (dataSourceCfg == null) { break; } dataSourceCfgList.add(dataSourceCfg); } return dataSourceCfgList; } private  DataSourceCfgUtil(); }
DataSourceCfgUtil { public static List<DataSourceCfg> getDataSourceCfgList() { List<DataSourceCfg> dataSourceCfgList = new ArrayList<>(MAX_DATA_SOURCE_COUNT); for (int i = 0; i < MAX_DATA_SOURCE_COUNT; i++) { DataSourceCfg dataSourceCfg = getDataSourceCfg(i); if (dataSourceCfg == null) { break; } dataSourceCfgList.add(dataSourceCfg); } return dataSourceCfgList; } private  DataSourceCfgUtil(); static List<DataSourceCfg> getDataSourceCfgList(); }
DataSourceCfgUtil { public static List<DataSourceCfg> getDataSourceCfgList() { List<DataSourceCfg> dataSourceCfgList = new ArrayList<>(MAX_DATA_SOURCE_COUNT); for (int i = 0; i < MAX_DATA_SOURCE_COUNT; i++) { DataSourceCfg dataSourceCfg = getDataSourceCfg(i); if (dataSourceCfg == null) { break; } dataSourceCfgList.add(dataSourceCfg); } return dataSourceCfgList; } private  DataSourceCfgUtil(); static List<DataSourceCfg> getDataSourceCfgList();  }