test_class.file: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/test/java/org/apache/shardingsphere/spring/boot/datasource/DataSourceMapSetterTest.java
test_class.identifier: DataSourceMapSetterTest
test_case.body: @Test
      public void assetMergedReplaceAndAdd() throws SQLException {
          MockEnvironment mockEnvironment = new MockEnvironment();
          mockEnvironment.setProperty("spring.shardingsphere.datasource.names", "ds0,ds1");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.common.type", "org.apache.commons.dbcp2.BasicDataSource");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.common.driver-class-name", "org.h2.Driver");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.common.max-total", "100");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.common.username", "Asa");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.common.password", "123");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds0.url", "jdbc:h2:mem:ds;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds0.username", "sa");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds0.max-total", "50");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds0.password", "");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds1.url", "jdbc:h2:mem:ds;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds1.username", "sa");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds1.max-total", "150");
          mockEnvironment.setProperty("spring.shardingsphere.datasource.ds1.password", "");
          StandardEnvironment standardEnvironment = new StandardEnvironment();
          standardEnvironment.merge(mockEnvironment);
          Map<String, DataSource> dataSourceMap = DataSourceMapSetter.getDataSourceMap(standardEnvironment);
          assertThat(dataSourceMap.size(), is(2));
          assertThat(dataSourceMap.get("ds0").getConnection().getMetaData().getUserName(), is("SA"));
          assertThat(dataSourceMap.get("ds1").getConnection().getMetaData().getUserName(), is("SA"));
      }
test_case.class_method_signature: DataSourceMapSetterTest.assetMergedReplaceAndAdd()
test_case.full_signature: @Test public void assetMergedReplaceAndAdd()
test_case.identifier: assetMergedReplaceAndAdd
test_case.invocations: setProperty setProperty setProperty setProperty setProperty setProperty setProperty setProperty setProperty setProperty setProperty setProperty setProperty setProperty merge getDataSourceMap assertThat size is assertThat getUserName getMetaData getConnection get is assertThat getUserName getMetaData getConnection get is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assetMergedReplaceAndAdd()
focal_class.declarator: PREFIX = "spring.shardingsphere.datasource."
focal_class.modifier: private static final
focal_class.original_string: private static final String PREFIX = "spring.shardingsphere.datasource.";
focal_class.type: String
focal_class.var_name: PREFIX
focal_class.declarator: COMMON_PREFIX = "spring.shardingsphere.datasource.common."
focal_class.modifier: private static final
focal_class.original_string: private static final String COMMON_PREFIX = "spring.shardingsphere.datasource.common.";
focal_class.type: String
focal_class.var_name: COMMON_PREFIX
focal_class.declarator: DATA_SOURCE_NAME = "name"
focal_class.modifier: private static final
focal_class.original_string: private static final String DATA_SOURCE_NAME = "name";
focal_class.type: String
focal_class.var_name: DATA_SOURCE_NAME
focal_class.declarator: DATA_SOURCE_NAMES = "names"
focal_class.modifier: private static final
focal_class.original_string: private static final String DATA_SOURCE_NAMES = "names";
focal_class.type: String
focal_class.var_name: DATA_SOURCE_NAMES
focal_class.declarator: DATA_SOURCE_TYPE = "type"
focal_class.modifier: private static final
focal_class.original_string: private static final String DATA_SOURCE_TYPE = "type";
focal_class.type: String
focal_class.var_name: DATA_SOURCE_TYPE
focal_class.declarator: JNDI_NAME = "jndi-name"
focal_class.modifier: private static final
focal_class.original_string: private static final String JNDI_NAME = "jndi-name";
focal_class.type: String
focal_class.var_name: JNDI_NAME
focal_class.file: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/datasource/DataSourceMapSetter.java
focal_class.identifier: DataSourceMapSetter
focal_class.class_method_signature: DataSourceMapSetter.getDataSourceMap(final Environment environment)
focal_class.full_signature: @SuppressWarnings("unchecked") public static Map<String, DataSource> getDataSourceMap(final Environment environment)
focal_class.identifier: getDataSourceMap
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (final Environment environment)
focal_class.return: Map<String, DataSource>
focal_class.signature: Map<String, DataSource> getDataSourceMap(final Environment environment)
focal_class.class_method_signature: DataSourceMapSetter.getDataSourceNames(final Environment environment, final String prefix)
focal_class.full_signature: private static List<String> getDataSourceNames(final Environment environment, final String prefix)
focal_class.identifier: getDataSourceNames
focal_class.modifiers: private static
focal_class.parameters: (final Environment environment, final String prefix)
focal_class.return: List<String>
focal_class.signature: List<String> getDataSourceNames(final Environment environment, final String prefix)
focal_class.class_method_signature: DataSourceMapSetter.getDataSource(final Environment environment, final String prefix, final String dataSourceName,
                                              final Map<String, Object> dataSourceCommonProps)
focal_class.full_signature: @SuppressWarnings("unchecked") private static DataSource getDataSource(final Environment environment, final String prefix, final String dataSourceName,
                                              final Map<String, Object> dataSourceCommonProps)
focal_class.identifier: getDataSource
focal_class.modifiers: @SuppressWarnings("unchecked") private static
focal_class.parameters: (final Environment environment, final String prefix, final String dataSourceName,
                                              final Map<String, Object> dataSourceCommonProps)
focal_class.return: DataSource
focal_class.signature: DataSource getDataSource(final Environment environment, final String prefix, final String dataSourceName,
                                              final Map<String, Object> dataSourceCommonProps)
focal_class.class_method_signature: DataSourceMapSetter.mergedDataSourceProps(final Map<String, Object> dataSourceProps, final Map<String, Object> dataSourceCommonProps)
focal_class.full_signature: private static Map<String, Object> mergedDataSourceProps(final Map<String, Object> dataSourceProps, final Map<String, Object> dataSourceCommonProps)
focal_class.identifier: mergedDataSourceProps
focal_class.modifiers: private static
focal_class.parameters: (final Map<String, Object> dataSourceProps, final Map<String, Object> dataSourceCommonProps)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> mergedDataSourceProps(final Map<String, Object> dataSourceProps, final Map<String, Object> dataSourceCommonProps)
focal_class.class_method_signature: DataSourceMapSetter.getJNDIDataSource(final String jndiName)
focal_class.full_signature: private static DataSource getJNDIDataSource(final String jndiName)
focal_class.identifier: getJNDIDataSource
focal_class.modifiers: private static
focal_class.parameters: (final String jndiName)
focal_class.return: DataSource
focal_class.signature: DataSource getJNDIDataSource(final String jndiName)
focal_method.body: @SuppressWarnings("unchecked")
      public static Map<String, DataSource> getDataSourceMap(final Environment environment) {
          Map<String, DataSource> result = new LinkedHashMap<>();
          Map<String, Object> dataSourceCommonProps = PropertyUtil.handle(environment, COMMON_PREFIX, Map.class);
          for (String each : getDataSourceNames(environment, PREFIX)) {
              try {
                  result.put(each, getDataSource(environment, PREFIX, each, dataSourceCommonProps));
              } catch (final ReflectiveOperationException ex) {
                  throw new ShardingSphereException("Can't find data source type.", ex);
              } catch (final NamingException ex) {
                  throw new ShardingSphereException("Can't find JNDI data source.", ex);
              }
          }
          return result;
      }
focal_method.class_method_signature: DataSourceMapSetter.getDataSourceMap(final Environment environment)
focal_method.full_signature: @SuppressWarnings("unchecked") public static Map<String, DataSource> getDataSourceMap(final Environment environment)
focal_method.identifier: getDataSourceMap
focal_method.invocations: handle getDataSourceNames put getDataSource
focal_method.modifiers: @SuppressWarnings("unchecked") public static
focal_method.parameters: (final Environment environment)
focal_method.return: Map<String, DataSource>
focal_method.signature: Map<String, DataSource> getDataSourceMap(final Environment environment)