INT-3996: Fix JdbcChannelMessageStore Javadoc

JIRA: https://jira.spring.io/browse/INT-3996

One of the query provider implementations was missing. To avoid a maintenance
nightmare, simply reference the interface's javadoc which lists all known
implementations.

* Simple `JdbcChannelMessageStore` JavaDocs polishing
* Add `LogAdjustingTestSupport` to the `StompIntegrationTests` to trace failures in the future.
* Also change the test `Start/Stop` messages to the `WARN` level in the `LogAdjustingTestSupport`, because `DEBUG` doesn't work everywhere.
Maybe some logging systems mix misconfiguration, like we have in the WebSocket modules with the Embedded Tomcat
This commit is contained in:
Gary Russell
2016-04-17 23:11:05 -04:00
committed by Artem Bilan
parent ae9cfc3ea5
commit 9e092d44f7
3 changed files with 18 additions and 24 deletions

View File

@@ -46,11 +46,8 @@ import org.springframework.core.serializer.support.SerializingConverter;
import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.jdbc.JdbcMessageStore; import org.springframework.integration.jdbc.JdbcMessageStore;
import org.springframework.integration.jdbc.store.channel.ChannelMessageStoreQueryProvider; import org.springframework.integration.jdbc.store.channel.ChannelMessageStoreQueryProvider;
import org.springframework.integration.jdbc.store.channel.DerbyChannelMessageStoreQueryProvider;
import org.springframework.integration.jdbc.store.channel.MessageRowMapper; import org.springframework.integration.jdbc.store.channel.MessageRowMapper;
import org.springframework.integration.jdbc.store.channel.MySqlChannelMessageStoreQueryProvider;
import org.springframework.integration.jdbc.store.channel.OracleChannelMessageStoreQueryProvider; import org.springframework.integration.jdbc.store.channel.OracleChannelMessageStoreQueryProvider;
import org.springframework.integration.jdbc.store.channel.PostgresChannelMessageStoreQueryProvider;
import org.springframework.integration.store.MessageGroup; import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.store.MessageGroupFactory; import org.springframework.integration.store.MessageGroupFactory;
import org.springframework.integration.store.MessageGroupStore; import org.springframework.integration.store.MessageGroupStore;
@@ -252,27 +249,17 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
} }
/** /**
* <p> * Sets the database specific {@link ChannelMessageStoreQueryProvider} to use.
* Sets the database specific {@link ChannelMessageStoreQueryProvider} to use. The {@link JdbcChannelMessageStore} * The {@link JdbcChannelMessageStore} provides the SQL queries to retrieve messages from
* provides the SQL queries to retrieve messages from the database. The * the database. See the JavaDocs {@link ChannelMessageStoreQueryProvider} (all known
* following {@link ChannelMessageStoreQueryProvider} are provided: * implementing classes) to see those implementations provided by the framework.
* </p> * <p> You can provide your own query implementations, if you need to support additional
* <ul> * databases and/or need to fine-tune the queries for your requirements.
* <li>{@link DerbyChannelMessageStoreQueryProvider}</li>
* <li>{@link MySqlChannelMessageStoreQueryProvider}</li>
* <li>{@link OracleChannelMessageStoreQueryProvider}</li>
* <li>{@link PostgresChannelMessageStoreQueryProvider}</li>
* </ul>
* <p>
* Beyond, you can provide your own query implementations, in case you need
* to support additional databases and/or need to fine-tune the queries for
* your requirements.
* </p>
*
* @param channelMessageStoreQueryProvider Must not be null. * @param channelMessageStoreQueryProvider Must not be null.
*/ */
public void setChannelMessageStoreQueryProvider(ChannelMessageStoreQueryProvider channelMessageStoreQueryProvider) { public void setChannelMessageStoreQueryProvider(ChannelMessageStoreQueryProvider channelMessageStoreQueryProvider) {
Assert.notNull(channelMessageStoreQueryProvider, "The provided channelMessageStoreQueryProvider must not be null."); Assert.notNull(channelMessageStoreQueryProvider,
"The provided channelMessageStoreQueryProvider must not be null.");
this.channelMessageStoreQueryProvider = channelMessageStoreQueryProvider; this.channelMessageStoreQueryProvider = channelMessageStoreQueryProvider;
} }

View File

@@ -34,8 +34,10 @@ import org.junit.rules.TestName;
* Base class for module tests where logging is set to TRACE for the duration * Base class for module tests where logging is set to TRACE for the duration
* of the test and reverted to the previous value. Also logs a start/end * of the test and reverted to the previous value. Also logs a start/end
* message. Duplicated in s-i-core/src/test for use there, to avoid circular dep. * message. Duplicated in s-i-core/src/test for use there, to avoid circular dep.
*
* @author Artem Bilan * @author Artem Bilan
* @author Gary Russell * @author Gary Russell
*
* @since 4.2.2 * @since 4.2.2
* *
*/ */
@@ -71,12 +73,12 @@ public class LogAdjustingTestSupport {
this.oldCategories.add(loggerToAdjust.getEffectiveLevel()); this.oldCategories.add(loggerToAdjust.getEffectiveLevel());
loggerToAdjust.setLevel(Level.TRACE); loggerToAdjust.setLevel(Level.TRACE);
} }
this.logger.debug("!!!! Starting test: " + this.testName.getMethodName() + " !!!!"); this.logger.warn("!!!! Starting test: " + this.testName.getMethodName() + " !!!!");
} }
@After @After
public void afterTest() { public void afterTest() {
logger.debug("!!!! Finished test: " + this.testName.getMethodName() + " !!!!"); logger.warn("!!!! Finished test: " + this.testName.getMethodName() + " !!!!");
Iterator<Level> oldCategory = this.oldCategories.iterator(); Iterator<Level> oldCategory = this.oldCategories.iterator();
for (Logger loggerToAdjust : this.loggersToAdjust) { for (Logger loggerToAdjust : this.loggersToAdjust) {
loggerToAdjust.setLevel(oldCategory.next()); loggerToAdjust.setLevel(oldCategory.next());

View File

@@ -56,6 +56,7 @@ import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.core.MessageProducer; import org.springframework.integration.core.MessageProducer;
import org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer; import org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer;
import org.springframework.integration.test.support.LogAdjustingTestSupport;
import org.springframework.integration.test.util.TestUtils; import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.transformer.ExpressionEvaluatingTransformer; import org.springframework.integration.transformer.ExpressionEvaluatingTransformer;
import org.springframework.integration.websocket.ClientWebSocketContainer; import org.springframework.integration.websocket.ClientWebSocketContainer;
@@ -108,7 +109,7 @@ import org.springframework.web.socket.sockjs.client.WebSocketTransport;
@ContextConfiguration @ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext @DirtiesContext
public class StompIntegrationTests { public class StompIntegrationTests extends LogAdjustingTestSupport {
@Value("#{server.serverContext}") @Value("#{server.serverContext}")
private ApplicationContext serverContext; private ApplicationContext serverContext;
@@ -128,6 +129,10 @@ public class StompIntegrationTests {
@Qualifier("webSocketEvents") @Qualifier("webSocketEvents")
private QueueChannel webSocketEvents; private QueueChannel webSocketEvents;
public StompIntegrationTests() {
super("org.springframework", "org.springframework.integration");
}
@Before @Before
public void setup() { public void setup() {
this.webSocketInputChannel.clear(); this.webSocketInputChannel.clear();