Package org.springframework.core.io

Examples of org.springframework.core.io.Resource


public class SaxUtilsTest {

    @Test
    public void testGetSystemId() throws Exception {
        Resource resource = new FileSystemResource("/path with spaces/file with spaces.txt");
        String systemId = SaxUtils.getSystemId(resource);
        Assert.assertNotNull("No systemId returned", systemId);
        Assert.assertTrue("Invalid system id", systemId.endsWith("path%20with%20spaces/file%20with%20spaces.txt"));
    }
View Full Code Here


   */
  @Override
  public List<String> query(String query, Map<?, ?> arguments) throws DataAccessException {
    Assert.hasText(query, "a script is required");

    Resource res = null;

    if (ResourceUtils.isUrl(query)) {
      if (resourceLoader != null) {
        res = resourceLoader.getResource(query);
      }
View Full Code Here

   */
  @Override
  public List<ExecJob> executeScript(String script, Map<?, ?> arguments) throws DataAccessException {
    Assert.hasText(script, "a script is required");

    Resource res = null;

    if (ResourceUtils.isUrl(script)) {
      if (resourceLoader != null) {
        res = resourceLoader.getResource(script);
      }
View Full Code Here

        Assert.assertEquals("Invalid SAAJ version", SaajUtils.SAAJ_13, SaajUtils.getSaajVersion());
    }

    @Test(expected = SOAPException.class)
    public void testGetSaajVersionInvalidEnvelope() throws Exception {
        Resource resource = new ClassPathResource("invalidNamespaceReferenceSoapMessage.xml", getClass());
        InputStream in = resource.getInputStream();
        MimeHeaders headers = new MimeHeaders();
        SOAPMessage soapMessage = messageFactory.createMessage(headers, in);
        SaajUtils.getSaajVersion(soapMessage);
    }
View Full Code Here

  }

  @SuppressWarnings("unused")
  private void validatePaths(String path, ResourcePatternResolver resourceLoader, boolean shouldExist)
      throws IOException {
    Resource res = resourceLoader.getResource(path);

    if (shouldExist) {
      Assert.isTrue(res.exists(), "The input path [" + path + "] does not exist");
    }
    else {
      Assert.isTrue(!res.exists(), "The output path [" + path + "] already exists");
    }
  }
View Full Code Here

  @Before
  public void setUp() throws SAXException, IOException, ParserConfigurationException {

    parser = new TypeFilterParser(context, classLoader);

    Resource sampleXmlFile = new ClassPathResource("type-filter-test.xml", TypeFilterParserUnitTests.class);

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);

    documentElement = factory.newDocumentBuilder().parse(sampleXmlFile.getInputStream()).getDocumentElement();
  }
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception{
    RestTemplate template = new RestTemplate();
    Resource s2logo = new ClassPathResource(resourcePath);
    MultiValueMap<String, Object> multipartMap = new LinkedMultiValueMap<String, Object>();
    multipartMap.add("company", "SpringSource");
    multipartMap.add("company-logo", s2logo);
    logger.info("Created multipart request: " + multipartMap);
    HttpHeaders headers = new HttpHeaders();
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception{
    ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/http-outbound-config.xml");
    Resource s2logo = new ClassPathResource(resourcePath);
    Map<String, Object> multipartMap = new HashMap<String, Object>();
    multipartMap.put("company", new String[]{"SpringSource", "VMWare"});
    multipartMap.put("company-logo", s2logo);
    logger.info("Created multipart request: " + multipartMap);
    MultipartRequestGateway requestGateway = context.getBean("requestGateway", MultipartRequestGateway.class);
View Full Code Here

    messageChannel.send(orderMessage);
    applicationContext.close();
  }

  private static GenericMessage<Document> createXmlMessageFromResource(String path) throws Exception {
    Resource orderRes = new ClassPathResource(path);

    DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
    builderFactory.setNamespaceAware(true);
    DocumentBuilder builder = builderFactory.newDocumentBuilder();

    Document orderDoc = builder.parse(orderRes.getInputStream());
    return new GenericMessage<Document>(orderDoc);
  }
View Full Code Here

       
        factory.setRepositoryName("jeceira-repo");
        factory.resolveConfigurationResource();
        ConfigManager config = factory.getConfigManager();
        DefaultResourceLoader loader = new DefaultResourceLoader();
        Resource res = loader.getResource("/jeceira.xml");
        assertEquals(res, factory.getConfiguration());
       
        factory = new RepositoryFactoryBean();
        factory.setConfigManager(config);
        factory.setRepositoryName("jeceira-repo");
View Full Code Here

TOP

Related Classes of org.springframework.core.io.Resource

Copyright © 2018 www.massapicom. 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.