Java Code Examples for org.apache.ibatis.io.Resources#getResourceAsProperties()

The following examples show how to use org.apache.ibatis.io.Resources#getResourceAsProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScriptRunnerTest.java    From mybaties with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldRunScriptsUsingProperties() throws Exception {
  Properties props = Resources.getResourceAsProperties(JPETSTORE_PROPERTIES);
  DataSource dataSource = new UnpooledDataSource(
      props.getProperty("driver"),
      props.getProperty("url"),
      props.getProperty("username"),
      props.getProperty("password"));
  ScriptRunner runner = new ScriptRunner(dataSource.getConnection());
  runner.setAutoCommit(true);
  runner.setStopOnError(false);
  runner.setErrorLogWriter(null);
  runner.setLogWriter(null);
  runJPetStoreScripts(runner);
  assertProductsTableExistsAndLoaded();
}
 
Example 2
Source File: ScriptRunnerTest.java    From mybatis with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldRunScriptsUsingProperties() throws Exception {
  Properties props = Resources.getResourceAsProperties(JPETSTORE_PROPERTIES);
  DataSource dataSource = new UnpooledDataSource(
      props.getProperty("driver"),
      props.getProperty("url"),
      props.getProperty("username"),
      props.getProperty("password"));
  ScriptRunner runner = new ScriptRunner(dataSource.getConnection());
  runner.setAutoCommit(true);
  runner.setStopOnError(false);
  runner.setErrorLogWriter(null);
  runner.setLogWriter(null);
  runJPetStoreScripts(runner);
  assertProductsTableExistsAndLoaded();
}
 
Example 3
Source File: BaseDataTest.java    From mybatis-typehandlers-postgis with Do What The F*ck You Want To Public License 5 votes vote down vote up
public static UnpooledDataSource createUnpooledDataSource(String resource) throws IOException {
    Properties props = Resources.getResourceAsProperties(resource);
    UnpooledDataSource ds = new UnpooledDataSource();
    ds.setDriver(props.getProperty("driver"));
    ds.setUrl(props.getProperty("url"));
    ds.setUsername(props.getProperty("username"));
    ds.setPassword(props.getProperty("password"));
    return ds;
}
 
Example 4
Source File: BaseDataTest.java    From mybaties with Apache License 2.0 5 votes vote down vote up
public static UnpooledDataSource createUnpooledDataSource(String resource) throws IOException {
  Properties props = Resources.getResourceAsProperties(resource);
  UnpooledDataSource ds = new UnpooledDataSource();
  ds.setDriver(props.getProperty("driver"));
  ds.setUrl(props.getProperty("url"));
  ds.setUsername(props.getProperty("username"));
  ds.setPassword(props.getProperty("password"));
  return ds;
}
 
Example 5
Source File: BaseDataTest.java    From mybaties with Apache License 2.0 5 votes vote down vote up
public static PooledDataSource createPooledDataSource(String resource) throws IOException {
  Properties props = Resources.getResourceAsProperties(resource);
  PooledDataSource ds = new PooledDataSource();
  ds.setDriver(props.getProperty("driver"));
  ds.setUrl(props.getProperty("url"));
  ds.setUsername(props.getProperty("username"));
  ds.setPassword(props.getProperty("password"));
  return ds;
}
 
Example 6
Source File: BaseDataTest.java    From mybatis with Apache License 2.0 5 votes vote down vote up
public static UnpooledDataSource createUnpooledDataSource(String resource) throws IOException {
  Properties props = Resources.getResourceAsProperties(resource);
  UnpooledDataSource ds = new UnpooledDataSource();
  ds.setDriver(props.getProperty("driver"));
  ds.setUrl(props.getProperty("url"));
  ds.setUsername(props.getProperty("username"));
  ds.setPassword(props.getProperty("password"));
  return ds;
}
 
Example 7
Source File: BaseDataTest.java    From mybatis with Apache License 2.0 5 votes vote down vote up
public static PooledDataSource createPooledDataSource(String resource) throws IOException {
  Properties props = Resources.getResourceAsProperties(resource);
  PooledDataSource ds = new PooledDataSource();
  ds.setDriver(props.getProperty("driver"));
  ds.setUrl(props.getProperty("url"));
  ds.setUsername(props.getProperty("username"));
  ds.setPassword(props.getProperty("password"));
  return ds;
}