Package org.springframework.core.io

Examples of org.springframework.core.io.ByteArrayResource


  public static BeanFactory toBeanFactory(String xml, boolean networkAccessPermission)
  {
     try
     {
        ByteArrayResource xmlResource = new ByteArrayResource(xml.getBytes());
        if (networkAccessPermission)
        {
           System.out.println("beanclassloader 1: " + SpringContextFunctions.class.getClassLoader());
          
          
View Full Code Here


  @SuppressWarnings("unchecked")
  private Map<String, DataExporter> getModuleExportersFromXML(byte[] configurationXML) {
    ApplicationContext moduleContext = null;
        if (configurationXML != null) {
           try {
             moduleContext = new GenericXmlApplicationContext( new ByteArrayResource( configurationXML ) );
             } catch (BeansException be) {
                 throw new RuntimeException("Unable to load Tatool file.", be);
             }
            
             // see whether we have exporters
View Full Code Here

                    eof = true;
                } else {
                    baos.write(temp);
                }
            }
            configResource = new ByteArrayResource(baos.toByteArray());

            if (LOG.isDebugEnabled()) {
                LOG.debug("Merged config: \n" + serialize(configResource));
            }
        } catch (MergeException e) {
View Full Code Here

                    eof = true;
                } else {
                    baos.write(temp);
                }
            }
            configResources = new Resource[]{new ByteArrayResource(baos.toByteArray())};

            if (LOG.isDebugEnabled()) {
                LOG.debug("Merged ApplicationContext Including Patches: \n" + serialize(configResources[0]));
            }
        } catch (MergeException e) {
View Full Code Here

                    eof = true;
                } else {
                    baos.write(temp);
                }
            }
            configResource = new ByteArrayResource(baos.toByteArray());

            if (LOG.isDebugEnabled()) {
                LOG.debug("Merged config: \n" + serialize(configResource));
            }
        } catch (MergeException e) {
View Full Code Here

  @Rule
  public ExpectedException exception = ExpectedException.none();

  @Test
  public void arrayConvertedToIndexedBeanReference() {
    this.processor.setResources(new ByteArrayResource(
        "foo: bar\nbar: [1,2,3]".getBytes()));
    this.processor.process(new MatchCallback() {
      @Override
      public void process(Properties properties, Map<String, Object> map) {
        assertEquals(1, properties.get("bar[0]"));
View Full Code Here

    });
  }

  @Test
  public void testStringResource() throws Exception {
    this.processor.setResources(new ByteArrayResource(
        "foo # a document that is a literal".getBytes()));
    this.processor.process(new MatchCallback() {
      @Override
      public void process(Properties properties, Map<String, Object> map) {
        assertEquals("foo", map.get("document"));
View Full Code Here

    });
  }

  @Test
  public void testBadDocumentStart() throws Exception {
    this.processor.setResources(new ByteArrayResource(
        "foo # a document\nbar: baz".getBytes()));
    this.exception.expect(ParserException.class);
    this.exception.expectMessage("line 2, column 1");
    this.processor.process(new MatchCallback() {
      @Override
View Full Code Here

    });
  }

  @Test
  public void testBadResource() throws Exception {
    this.processor.setResources(new ByteArrayResource(
        "foo: bar\ncd\nspam:\n  foo: baz".getBytes()));
    this.exception.expect(ScannerException.class);
    this.exception.expectMessage("line 3, column 1");
    this.processor.process(new MatchCallback() {
      @Override
View Full Code Here

    });
  }

  @Test
  public void mapConvertedToIndexedBeanReference() {
    this.processor.setResources(new ByteArrayResource(
        "foo: bar\nbar:\n spam: bucket".getBytes()));
    this.processor.process(new MatchCallback() {
      @Override
      public void process(Properties properties, Map<String, Object> map) {
        // System.err.println(properties);
View Full Code Here

TOP

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

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.