Package org.apache.camel

Examples of org.apache.camel.StreamCache.reset()


        assertTrue("Should get the FileInputStreamCache", cache instanceof FileInputStreamCache);
        String temp = toString((InputStream)cache);
        ((InputStream)cache).close();
        assertEquals("Cached a wrong file", temp, TEST_STRING);
        try {
            cache.reset();
            // The stream is closed, so the temp file is gone.
            fail("we expect the exception here");
        } catch (Exception exception) {
            // do nothing
        }
View Full Code Here


       
        StreamCache cache = cos.getStreamCache();
        assertTrue("Should get the FileInputStreamCache", cache instanceof FileInputStreamCache);
        String temp = toString((InputStream)cache);
        assertEquals("Cached a wrong file", temp, TEST_STRING);
        cache.reset();
        temp = toString((InputStream)cache);
        assertEquals("Cached a wrong file", temp, TEST_STRING);
       
        ((InputStream)cache).close();
        files = file.list();
View Full Code Here

            answer = message.getBody();
        }

        if (newBody != null) {
            // Reset the InputStreamCache
            newBody.reset();
        }

        return answer != null ? answer.toString() : null;
    }
View Full Code Here

            answer = message.getBody();
        }

        if (newBody != null) {
            // Reset the StreamCache
            newBody.reset();
        }
        return answer;
    }

    protected Object getBodyTypeAsString(Message message) {
View Full Code Here

        StreamSource source = new StreamSource(getTestFileStream());
        StreamCache cache = converter.convertToStreamCache(source, exchange);
        //assert re-readability of the cached StreamSource
        XmlConverter converter = new XmlConverter();
        assertNotNull(converter.toString((Source)cache, null));
        cache.reset();
        assertNotNull(converter.toString((Source)cache, null));
    }

    public void testConvertToStreamCacheInputStream() throws Exception {
        InputStream is = getTestFileStream();
View Full Code Here

        assertEquals("we should have a temp file", files.length, 1);
        assertEquals("Cached a wrong file", temp, TEST_STRING);
        exchange.getUnitOfWork().done(exchange);

        try {
            cache.reset();
            // The stream is closed, so the temp file is gone.
            fail("we expect the exception here");
        } catch (Exception exception) {
            // do nothing
        }
View Full Code Here

       
        StreamCache cache = cos.getStreamCache();
        assertTrue("Should get the FileInputStreamCache", cache instanceof FileInputStreamCache);
        String temp = toString((InputStream)cache);
        assertEquals("Cached a wrong file", temp, TEST_STRING);
        cache.reset();
        temp = toString((InputStream)cache);
        assertEquals("Cached a wrong file", temp, TEST_STRING);       
        exchange.getUnitOfWork().done(exchange);
        assertEquals("we should have a temp file", files.length, 1);
        ((InputStream)cache).close();
View Full Code Here

        StreamSource source = new StreamSource(getTestFileStream());
        StreamCache cache = converter.convertToStreamCache(source, exchange);
        //assert re-readability of the cached StreamSource
        XmlConverter converter = new XmlConverter();
        assertNotNull(converter.toString((Source)cache));
        cache.reset();
        assertNotNull(converter.toString((Source)cache));
    }

    public void testConvertToStreamCacheInputStream() throws Exception {
        InputStream is = getTestFileStream();
View Full Code Here

        assertEquals("Cached a wrong file", temp, TEST_STRING);

        exchange.getUnitOfWork().done(exchange);

        try {
            cache.reset();
            // The stream is closed, so the temp file is gone.
            fail("we expect the exception here");
        } catch (Exception exception) {
            // do nothing
        }
View Full Code Here

       
        StreamCache cache = cos.getStreamCache();
        assertTrue("Should get the FileInputStreamCache", cache instanceof FileInputStreamCache);
        String temp = toString((InputStream)cache);
        assertEquals("Cached a wrong file", temp, TEST_STRING);
        cache.reset();
        temp = toString((InputStream)cache);
        assertEquals("Cached a wrong file", temp, TEST_STRING);
       
        exchange.getUnitOfWork().done(exchange);
        ((InputStream)cache).close();
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.