Spring Framework InputStreamResource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework InputStreamResource class.

This code example shows how to use the following methods:
public class DefaultStatisticsDaemonConfigDaoTest extends TestCase {
    public void testAfterPropertiesSetWithGoodConfigFile() throws Exception {
        DefaultStatisticsDaemonConfigDao dao = new DefaultStatisticsDaemonConfigDao();
         
        InputStream in = ConfigurationTestUtils.getInputStreamForConfigFile("statsd-configuration.xml");
        dao.setConfigResource(new InputStreamResource(in));
        dao.afterPropertiesSet();
    } 
     
    public void testGetReports() throws Exception {
        DefaultStatisticsDaemonConfigDao dao = new DefaultStatisticsDaemonConfigDao();
         
        InputStream in = ConfigurationTestUtils.getInputStreamForConfigFile("statsd-configuration.xml");
        dao.setConfigResource(new InputStreamResource(in));
        dao.afterPropertiesSet();
 
        List<Report> reports = dao.getReports();
        assertNotNull("reports list should not be null", reports);
        assertEquals("reports list size", 5, reports.size());
         
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
public class ProxySnmpAgentConfigFactory extends SnmpPeerFactory { 
	 
	private static final Logger LOG = LoggerFactory.getLogger(ProxySnmpAgentConfigFactory.class); 
 
    public ProxySnmpAgentConfigFactory(final InputStream config) throws MarshalException, ValidationException, FileNotFoundException, IOException { 
        super(new InputStreamResource(config)); 
    } 
 
    @Override 
    public SnmpAgentConfig getAgentConfig(final InetAddress address) { 
    	final SnmpAgentConfigProxyMapper mapper = SnmpAgentConfigProxyMapper.getInstance(); 
    	final SnmpAgentAddress agentAddress = mapper.getAddress(address); 
    	 
    	final String addressString = str(address); 
		if (agentAddress == null) { 
			LOG.debug("No agent address mapping found for {}!  Try adding a @JUnitSnmpAgent(host=\"{}\", resource=\"...\" entry...", addressString, addressString); 
    		return super.getAgentConfig(address); 
    		// throw new IllegalArgumentException("No agent address mapping found for " + addressString); 
    	} 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
/** 
 */ 
public class ResourceLineReaderTests extends TestCase {
 
	public void testBadResource() throws Exception {
		ResourceLineReader reader = new ResourceLineReader(new InputStreamResource(new InputStream() {
			public int read() throws IOException {
				throw new IOException("Foo");
			} 
		})); 
		try { 
			reader.read();
			fail("Expected InvalidBatchException");
		} catch (InvalidBatchException e) {
			// expected 
			assertTrue(e.getMessage().startsWith("Unable to read"));
		} 
	} 
 
	public void testRead() throws Exception {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    public void testAfterPropertiesSetWithGoodConfigFile() throws Exception {
        AccessPointMonitorConfigDaoJaxb dao = new AccessPointMonitorConfigDaoJaxb();
 
        InputStream in = ConfigurationTestUtils.getInputStreamForConfigFile("access-point-monitor-configuration.xml");
        dao.setConfigResource(new InputStreamResource(in));
        dao.afterPropertiesSet();
 
        assertNotNull("access point monitor config should not be null", dao.getConfig());
    } 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
     
    public void testAfterPropertiesSetWithGoodConfigFile() throws Exception {
        JdbcDataCollectionConfigDaoJaxb dao = new JdbcDataCollectionConfigDaoJaxb();
         
        InputStream in = ConfigurationTestUtils.getInputStreamForConfigFile("jdbc-datacollection-config.xml");
        dao.setConfigResource(new InputStreamResource(in));
        dao.afterPropertiesSet();
         
        assertNotNull("jdbc data collection should not be null", dao.getConfig());
    } 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
            BpmnAutoLayout autoLayout = new BpmnAutoLayout(bpmnModel); 
            autoLayout.execute(); 
        } 
 
        InputStream is = processDiagramGenerator.generateJpgDiagram(bpmnModel); 
        return new InputStreamResource(is); 
    } 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
assertEquals(1, count);
	} 
 
	public void testWhitespace() throws Exception {
		Resource resource = new InputStreamResource(new ByteArrayInputStream(" foo ,bar,spam".getBytes()));
		ResourceFieldSetReader reader = new ResourceFieldSetReader(resource);
		FieldSet fieldSet = reader.read();
		assertNotNull(fieldSet);
		assertEquals("foo", fieldSet.readString(0));
	} 
 
	public void testQuotes() throws Exception {
		Resource resource = new InputStreamResource(new ByteArrayInputStream("\" foo \",bar,\"spam\"".getBytes()));
		ResourceFieldSetReader reader = new ResourceFieldSetReader(resource);
		FieldSet fieldSet = reader.read();
		assertNotNull(fieldSet);
		// TODO: maybe this should be with the whitespace still? 
		assertEquals("foo", fieldSet.readString(0));
		assertEquals("spam", fieldSet.readString(2));
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    { 
        if (bookId == null) { throw new IllegalArgumentException( 
                "Book id cannot be null to export."); } 
 
        InputStream bookStream = this.inputRenderer.exportBook(bookId); 
        InputStream result = toPdfConvertor.performTransformation(new InputStreamResource( 
                bookStream)); 
        return result; 
    } 
 
    public InputStream exportLatex(Long bookId) 
    { 
 
        if (bookId == null) { throw new IllegalArgumentException( 
                "Book id cannot be null to export."); } 
 
        /** Generate Latex */ 
        InputStream bookStream = this.inputRenderer.exportBook(bookId); 
        InputStream xhtml = toXHTMLConvertor.performTransformation(new InputStreamResource( 
                bookStream)); 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    static ParserContext createFakeParserContext() {
        return new ParserContext(new XmlReaderContext(thisClassAsResource(), new FailFastProblemReporter(), null, null, null, null), null);
    } 
 
    static InputStreamResource thisClassAsResource() {
        return new InputStreamResource(ParserTestUtil.class.getResourceAsStream(ParserTestUtil.class.getSimpleName() + ".class"));
    } 
 
 
    static org.w3c.dom.Document loadXMLFrom(String xml)
            throws org.xml.sax.SAXException, java.io.IOException {
        return loadXMLFrom(new java.io.ByteArrayInputStream(xml.getBytes()));
    } 
 
    static org.w3c.dom.Document loadXMLFrom(java.io.InputStream is)
            throws org.xml.sax.SAXException, java.io.IOException {
        javax.xml.parsers.DocumentBuilderFactory factory =
                javax.xml.parsers.DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        javax.xml.parsers.DocumentBuilder builder = null;
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
     
    public void testAfterPropertiesSetWithGoodConfigFile() throws Exception {
        TestCastorConfigDao dao = new TestCastorConfigDao();
         
        InputStream in = ConfigurationTestUtils.getInputStreamForConfigFile("users.xml");
        dao.setConfigResource(new InputStreamResource(in));
        dao.afterPropertiesSet();
         
        assertNotNull("userinfo should not be null", dao.getUserinfo());
    } 
 
    public static class TestCastorConfigDao extends AbstractCastorConfigDao<Userinfo, Userinfo> { 
        public TestCastorConfigDao() { 
            super(Userinfo.class, "user information configuration"); 
        } 
 
        @Override 
        public Userinfo translateConfig(Userinfo castorConfig) {
            return castorConfig;
        } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java