CreateDataSourcesStatementContextConverter implements SQLStatementContextConverter<CreateDataSourcesStatementContext, Map<String, YamlDataSourceParameter>> { @Override public Map<String, YamlDataSourceParameter> convert(final CreateDataSourcesStatementContext context) { Map<String, YamlDataSourceParameter> result = new LinkedHashMap<>(context.getSqlStatement().getConnectionInfos().size(), 1); for (DataSourceConnectionSegment each : context.getSqlStatement().getConnectionInfos()) { DataSourceParameter parameter = new DataSourceParameter(); YamlDataSourceParameter dataSource = new YamlDataSourceParameter(); dataSource.setUrl(context.getUrl(each)); dataSource.setUsername(each.getUser()); dataSource.setPassword(each.getPassword()); dataSource.setMinPoolSize(parameter.getMinPoolSize()); dataSource.setMaxPoolSize(parameter.getMaxPoolSize()); dataSource.setConnectionTimeoutMilliseconds(parameter.getConnectionTimeoutMilliseconds()); dataSource.setIdleTimeoutMilliseconds(parameter.getIdleTimeoutMilliseconds()); dataSource.setMaintenanceIntervalMilliseconds(parameter.getMaintenanceIntervalMilliseconds()); result.put(each.getName(), dataSource); } return result; }  @Override Map<String, YamlDataSourceParameter> convert(final CreateDataSourcesStatementContext context);  }
@Test public void assertGenerate() { Map<String, YamlDataSourceParameter> result = new CreateDataSourcesStatementContextConverter().convert(sqlStatement); assertThat(result.size(), is(2)); assertTrue(result.keySet().containsAll(Arrays.asList("ds0", "ds1"))); assertThat(result.values().iterator().next().getUsername(), is("root0")); }