Examples of EncodedResource


Examples of org.springframework.core.io.support.EncodedResource

  @Test
  public void testRefToSingleton() throws Exception {
    DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
    reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
    reader.loadBeanDefinitions(new EncodedResource(REFTYPES_CONTEXT, "ISO-8859-1"));

    TestBean jen = (TestBean) xbf.getBean("jenny");
    TestBean dave = (TestBean) xbf.getBean("david");
    TestBean jenks = (TestBean) xbf.getBean("jenks");
    ITestBean davesJen = dave.getSpouse();
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @param resource the resource descriptor for the Groovy script
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource));
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
    if (logger.isInfoEnabled()) {
      logger.info("Executing SQL script '" + sqlResourcePath + "'");
    }

    EncodedResource resource =
        new EncodedResource(getApplicationContext().getResource(sqlResourcePath), this.sqlScriptEncoding);
    long startTime = System.currentTimeMillis();
    List statements = new LinkedList();
    try {
      LineNumberReader lnr = new LineNumberReader(resource.getReader());
      String script = JdbcTestUtils.readScript(lnr);
      char delimiter = ';';
      if (!JdbcTestUtils.containsSqlScriptDelimiters(script, delimiter)) {
        delimiter = '\n';
      }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

    assertTrue("test with '\\n' is wrong", !containsSqlScriptDelimiters("select 1; select '\\n\n';", "\n"));
    assertTrue("test with delimiter \\n is wrong", containsSqlScriptDelimiters("select 1\n select 2", "\n"));
  }

  private String readScript(String path) throws Exception {
    EncodedResource resource = new EncodedResource(new ClassPathResource(path, getClass()));
    return ScriptUtils.readScript(resource);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * using the configured {@linkplain #setSqlScriptEncoding encoding}.
   * @param script the script to wrap; never {@code null}
   */
  private EncodedResource encodeScript(Resource script) {
    Assert.notNull(script, "Script must not be null");
    return new EncodedResource(script, this.sqlScriptEncoding);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @see #DEFAULT_COMMENT_PREFIX
   * @see #DEFAULT_BLOCK_COMMENT_START_DELIMITER
   * @see #DEFAULT_BLOCK_COMMENT_END_DELIMITER
   */
  public static void executeSqlScript(Connection connection, Resource resource) throws ScriptException {
    executeSqlScript(connection, new EncodedResource(resource));
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * or {@link org.springframework.jdbc.datasource.init.ResourceDatabasePopulator}.
   */
  @Deprecated
  public static void executeSqlScript(JdbcTemplate jdbcTemplate, Resource resource, boolean continueOnError)
      throws DataAccessException {
    executeSqlScript(jdbcTemplate, new EncodedResource(resource), continueOnError);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  private EncodedResource applyEncodingIfNecessary(Resource script) {
    if (script instanceof EncodedResource) {
      return (EncodedResource) script;
    }
    else {
      return new EncodedResource(script, this.sqlScriptEncoding);
    }
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @param resource the resource descriptor for the XML file
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource));
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @throws DataAccessException if there is an error executing a statement
   * and continueOnError was <code>false</code>
   */
  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
    Resource resource = this.applicationContext.getResource(sqlResourcePath);
    SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource,
      this.sqlScriptEncoding), continueOnError);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.