List of usage examples for org.springframework.integration.jdbc StoredProcExecutor setJdbcCallOperationsCacheSize
public void setJdbcCallOperationsCacheSize(int jdbcCallOperationsCacheSize)
From source file:org.springframework.integration.jdbc.StoredProcExecutorTests.java
@Test public void testSetJdbcCallOperationsCacheSize() throws Exception { final DataSource datasource = mock(DataSource.class); final StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource); storedProcExecutor.setJdbcCallOperationsCacheSize(0); final ExpressionFactoryBean efb = new ExpressionFactoryBean("headers['stored_procedure_name']"); efb.afterPropertiesSet();// w w w .j av a 2 s . c o m final Expression expression = efb.getObject(); storedProcExecutor.setStoredProcedureNameExpression(expression); storedProcExecutor.setBeanFactory(mock(BeanFactory.class)); storedProcExecutor.afterPropertiesSet(); this.mockTheOperationsCache(storedProcExecutor); for (int i = 1; i <= 10; i++) { storedProcExecutor.executeStoredProcedure( MessageBuilder.withPayload("test").setHeader("stored_procedure_name", "123").build()); } final CacheStats stats = (CacheStats) storedProcExecutor.getJdbcCallOperationsCacheStatistics(); LOGGER.info(stats); assertEquals("Expected a cache misscount of 10", 10, stats.missCount()); }