diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java index 636024c55c..bc92908b90 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/PointToPointChannelParser.java @@ -37,10 +37,8 @@ public class PointToPointChannelParser extends AbstractChannelParser { private static final String DISPATCHER_PACKAGE = IntegrationNamespaceUtils.BASE_PACKAGE + ".dispatcher"; - private final Log logger = LogFactory.getLog(this.getClass()); - @Override protected BeanDefinitionBuilder buildBeanDefinition(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = null; @@ -49,11 +47,20 @@ public class PointToPointChannelParser extends AbstractChannelParser { // configure a queue-based channel if any queue sub-element is defined if ((queueElement = DomUtils.getChildElementByTagName(element, "queue")) != null) { builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".QueueChannel"); - boolean hasCapacity = this.parseQueueCapacity(builder, queueElement); + boolean hasStoreRef = this.parseStoreRef(builder, queueElement, element.getAttribute(ID_ATTRIBUTE)); boolean hasQueueRef = this.parseQueueRef(builder, queueElement); - if (hasCapacity && hasQueueRef) { - parserContext.getReaderContext().error("The 'capacity' attribute is not allowed" + - " when providing a 'ref' to a custom queue.", element); + if (!hasStoreRef) { + boolean hasCapacity = this.parseQueueCapacity(builder, queueElement); + if (hasCapacity && hasQueueRef) { + parserContext.getReaderContext().error( + "The 'capacity' attribute is not allowed" + " when providing a 'ref' to a custom queue.", + element); + } + } + if (hasStoreRef && hasQueueRef) { + parserContext.getReaderContext().error( + "The 'message-store' attribute is not allowed" + " when providing a 'ref' to a custom queue.", + element); } } else if ((queueElement = DomUtils.getChildElementByTagName(element, "priority-queue")) != null) { @@ -74,14 +81,15 @@ public class PointToPointChannelParser extends AbstractChannelParser { String dispatcherAttribute = element.getAttribute("dispatcher"); boolean hasDispatcherAttribute = StringUtils.hasText(dispatcherAttribute); if (hasDispatcherAttribute && logger.isWarnEnabled()) { - logger.warn("The 'dispatcher' attribute on the 'channel' element is deprecated. " + - "Please use the 'dispatcher' sub-element instead."); + logger.warn("The 'dispatcher' attribute on the 'channel' element is deprecated. " + + "Please use the 'dispatcher' sub-element instead."); } // verify that a dispatcher is not provided if a queue sub-element exists if (queueElement != null && (dispatcherElement != null || hasDispatcherAttribute)) { - parserContext.getReaderContext().error("The 'dispatcher' attribute or sub-element " + - "and any queue sub-element are mutually exclusive.", element); + parserContext.getReaderContext().error( + "The 'dispatcher' attribute or sub-element " + "and any queue sub-element are mutually exclusive.", + element); return null; } @@ -90,9 +98,10 @@ public class PointToPointChannelParser extends AbstractChannelParser { } if (dispatcherElement != null && hasDispatcherAttribute) { - parserContext.getReaderContext().error("The 'dispatcher' attribute and 'dispatcher' " + - "sub-element are mutually exclusive. NOTE: the attribute is DEPRECATED. " + - "Please use the dispatcher sub-element instead.", element); + parserContext.getReaderContext().error( + "The 'dispatcher' attribute and 'dispatcher' " + + "sub-element are mutually exclusive. NOTE: the attribute is DEPRECATED. " + + "Please use the dispatcher sub-element instead.", element); return null; } @@ -102,15 +111,15 @@ public class PointToPointChannelParser extends AbstractChannelParser { builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".DirectChannel"); if (!"failover".equals(dispatcherAttribute)) { // round-robin dispatcher is used by default, the "failover" value simply disables it - builder.addConstructorArgValue(new RootBeanDefinition( - DISPATCHER_PACKAGE + ".RoundRobinLoadBalancingStrategy", null, null)); + builder.addConstructorArgValue(new RootBeanDefinition(DISPATCHER_PACKAGE + + ".RoundRobinLoadBalancingStrategy", null, null)); } } else if (dispatcherElement == null) { // configure the default DirectChannel with a RoundRobinLoadBalancingStrategy builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".DirectChannel"); - builder.addConstructorArgValue(new RootBeanDefinition( - DISPATCHER_PACKAGE + ".RoundRobinLoadBalancingStrategy", null, null)); + builder.addConstructorArgValue(new RootBeanDefinition(DISPATCHER_PACKAGE + + ".RoundRobinLoadBalancingStrategy", null, null)); } else { // configure either an ExecutorChannel or DirectChannel based on existence of 'task-executor' @@ -126,8 +135,8 @@ public class PointToPointChannelParser extends AbstractChannelParser { // configure the default RoundRobinLoadBalancingStrategy String loadBalancer = dispatcherElement.getAttribute("load-balancer"); if (!"none".equals(loadBalancer)) { - builder.addConstructorArgValue(new RootBeanDefinition( - DISPATCHER_PACKAGE + ".RoundRobinLoadBalancingStrategy", null, null)); + builder.addConstructorArgValue(new RootBeanDefinition(DISPATCHER_PACKAGE + + ".RoundRobinLoadBalancingStrategy", null, null)); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, dispatcherElement, "failover"); } @@ -145,11 +154,25 @@ public class PointToPointChannelParser extends AbstractChannelParser { private boolean parseQueueRef(BeanDefinitionBuilder builder, Element queueElement) { String queueRef = queueElement.getAttribute("ref"); - if (StringUtils.hasText(queueRef)){ + if (StringUtils.hasText(queueRef)) { builder.addConstructorArgReference(queueRef); return true; } return false; } + private boolean parseStoreRef(BeanDefinitionBuilder builder, Element queueElement, String channel) { + String storeRef = queueElement.getAttribute("message-store"); + if (StringUtils.hasText(storeRef)) { + BeanDefinitionBuilder queueBuilder = BeanDefinitionBuilder + .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".store.MessageGroupQueue"); + queueBuilder.addConstructorArgReference(storeRef); + queueBuilder.addConstructorArgValue(channel); + parseQueueCapacity(queueBuilder, queueElement); + builder.addConstructorArgValue(queueBuilder.getBeanDefinition()); + return true; + } + return false; + } + } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java index 4f78903f0d..365f5b14af 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java @@ -139,12 +139,15 @@ public class MessageGroupQueue extends AbstractQueue> implements Bloc } public boolean offer(Message e, long timeout, TimeUnit unit) throws InterruptedException { - if (!offer(e)) { + long threshold = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(timeout, unit); + boolean result = offer(e); + while (!result && System.currentTimeMillis() < threshold) { synchronized (writeLock) { - writeLock.wait(TimeUnit.MILLISECONDS.convert(timeout, unit)); + writeLock.wait(threshold - System.currentTimeMillis()); } + result = offer(e); } - return offer(e); + return result; } public Message poll(long timeout, TimeUnit unit) throws InterruptedException { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java index 4f6adb66e6..d29f4bed09 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java @@ -164,9 +164,7 @@ public class SimpleMessageGroup implements MessageGroup { public void markAll() { synchronized (lock) { - marked.addAll(unmarked); - unmarked.clear(); - // unmarked.drainTo(marked); + unmarked.drainTo(marked); } } diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd index 603b7468d1..7422cd8bde 100644 --- a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd +++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd @@ -1,9 +1,8 @@ - + @@ -28,7 +27,8 @@ Defines the ApplicationEventMulticaster to use for this ApplicationContext. - The "task-executor" reference is optional. If not provided, an + The "task-executor" + reference is optional. If not provided, an instance of ThreadPoolTaskExecutor will be created by default. @@ -81,15 +81,15 @@ Identifies this channel as a Queue style channel where messages could be prioritized - based on custom logic + based on + custom logic - + Defines a queue for messages. If 'capacity' is specified, it will be a bounded queue. - A custom Queue implementation can be injected using the 'ref' + A custom Queue + implementation can be injected using the 'ref' attribute. @@ -115,12 +116,36 @@ Capacity for this queue. Default capacity is 0 which means - this queue will accumulate as many messages as memory allows. + this queue will accumulate as many + messages as available resources allow. + + + + Reference to a MessageGroupStore that can be used to buffer the messages. If a message store is + specified then it will store messages for this channel with a correlation key equal to the + channel name. If you need more control over the correlation key (e.g. two channels in the same + application share a name), then you need to look to the queue implementation itself and provide an + explicit instance via the "ref" attribute, or else maybe the + message store has a way to specify a region or similar additional + tag for messages. This attribute is + mutually exclusive with the "ref" attribute (only one can be specified). + + + + + + + + + + Reference to a BlockingQueue that can be used to buffer the messages. This attribute is + mutually exclusive with the "message-store" attribute (only one can be specified). + @@ -140,7 +165,8 @@ Capacity for this queue. Default capacity is 0 which means - this queue will accumulate as many messages as memory allows. + this queue will accumulate as many + messages as available resources allow. @@ -177,7 +203,8 @@ Defines a load-balancing strategy for the channel's dispatcher. - The default is a round-robin load balancer. + The default is a round-robin load + balancer. @@ -185,7 +212,8 @@ [DEFAULT] Defines a Round Robin dispatching strategy which allows - load balancing of messages between multiple Message Handlers. Which + load balancing of messages + between multiple Message Handlers. Which message handler receives the message first is determined by the 'order' attribute @@ -207,17 +235,22 @@ Specifies whether this dispatcher has failover enabled. By default, - failover will be enabled. Set this to 'false' to disable it. + failover will be enabled. Set + this to 'false' to disable it. When enabled and message delivery to the primary Message Handler fails, - an attempt will be made to deliver the message to the next handler + an attempt + will be made to deliver the message to the next handler and so on... - Primary, secondary etc... is determined by the load-balancing strategy in + Primary, secondary etc... is determined by the + load-balancing strategy in use (e.g. round-robin). If no load-balancer strategy is configured, the order will - be fixed in a sequence determined by the 'order' attribute on the + be fixed + in a sequence determined by the 'order' attribute on the Message Handlers - (or the @Ordered annotation on adapted methods). + (or the @Ordered annotation on adapted + methods). @@ -255,8 +288,7 @@ - + - + @@ -301,8 +332,7 @@ - + Specify whether Exceptions thrown by any subscribed handler should be @@ -310,8 +340,7 @@ - + Specify whether the sequence size, sequence number, and correlation id @@ -332,7 +361,7 @@ - + @@ -357,7 +386,8 @@ Enables failover, but disables load-balancing. - See the dispatcher sub-element for more information. + See the dispatcher sub-element for more + information. @@ -403,8 +433,7 @@ - + - + - + @@ -516,8 +543,7 @@ - + @@ -563,8 +589,7 @@ - + @@ -596,7 +621,8 @@ Defines a Channel Adapter that receives from a MessageChannel and passes to - a method-invoking MessageHandler. + a method-invoking + MessageHandler. @@ -606,7 +632,8 @@ Specifies the order for invocation when this endpoint is connected as a - subscriber to a SubscribableChannel. + subscriber to a + SubscribableChannel. @@ -689,8 +716,7 @@ - + @@ -698,24 +724,25 @@ - + - + Defines an endpoint for exposing any bean reference as a service that - receives request Messages from an 'input-channel' and may send reply + receives request Messages + from an 'input-channel' and may send reply Messages to an 'output-channel'. The 'ref' may point to an instance - that has either a single public method or a method with the - @ServiceActivator annotation. Otherwise, the 'method' attribute + that + has either a single public method or a method with the + @ServiceActivator annotation. Otherwise, the 'method' + attribute should be provided along with 'ref'. @@ -755,7 +782,8 @@ Base type for Message Endpoint elements that accept Messages from an - input-channel and also may produce reply Messages to be sent to an + input-channel and also may + produce reply Messages to be sent to an output-channel. @@ -765,8 +793,7 @@ - + @@ -774,8 +801,8 @@ - Specify the maximum amount of time in milliseconds to wait when sending a reply - Message to the output channel. By default the send will block for one second. + Specify the maximum amount of time in milliseconds to wait when sending a reply + Message to the output channel. By default the send will block for one second. @@ -797,8 +824,7 @@ - + @@ -853,7 +879,8 @@ Defines an endpoint that passes a Message to the output-channel after a delay. The delay may - be retrieved from a Message header or else fallback to the + be + retrieved from a Message header or else fallback to the 'default-delay' of this endpoint. @@ -861,18 +888,18 @@ - + - + Specify the default delay in milliseconds. This value can be set to 0 if the only Messages - that should be delayed are those with a particular header (in that + that + should be delayed are those with a particular header (in that case, be sure to provide - a value for the 'delay-header-name' attribute). + a value for the + 'delay-header-name' attribute). @@ -883,7 +910,8 @@ This value can either represent the number of milliseconds to delay counting from the current time or it can be an - absolute Date until which the Message should be delayed. + absolute Date until + which the Message should be delayed. @@ -894,12 +922,12 @@ this endpoint should delegate when scheduling the sending of delayed Messages. If not provided, the default - will use a thread pool of size 1. + will use a thread pool of + size 1. - + @@ -908,22 +936,21 @@ Provide a reference to the MessageStore instance that should be used - to store Messages while awaiting the delay. + to store Messages while + awaiting the delay. - + - + Specify whether tasks should be able to complete on shutdown. By - default this is 'false'. + default this is 'false'. @@ -944,17 +971,14 @@ - + - + - + @@ -975,8 +999,7 @@ - + @@ -1013,8 +1036,7 @@ - + @@ -1039,8 +1061,7 @@ - + @@ -1058,8 +1079,7 @@ - + @@ -1087,8 +1107,7 @@ - + Provides a MessageSelector reference. If a method attribute is set the - referred bean doesn't need to implement the MessageSelector + referred bean doesn't need + to implement the MessageSelector interface. @@ -1208,7 +1228,8 @@ Boolean value to indicate whether this header value should overwrite - an existing header value for the same name. + an existing header + value for the same name. @@ -1224,18 +1245,20 @@ - + Specify the default boolean value for whether to overwrite existing - header values. This will only take effect for + header values. This will + only take effect for sub-elements that do not provide their own 'overwrite' attribute. If the - 'default-overwrite' attribute is not + 'default-overwrite' + attribute is not provided, then the specified header values will NOT overwrite any - existing ones with the same header names. + existing ones with the same + header names. @@ -1246,8 +1269,10 @@ Specify whether null values, such as might be returned from an expression evaluation, - should be skipped. The default value is true. Set this to false if a null value should - trigger removal of the corresponding header instead. + should be + skipped. The default value is true. Set this to false if a null value should + trigger removal of the corresponding + header instead. @@ -1258,10 +1283,11 @@ Reference to an Object to be invoked for header values. - The 'method' attribute is required along with this. + The 'method' attribute is required + along with this. - + @@ -1269,10 +1295,11 @@ Method to be invoked on the referenced Object as specified by the - 'ref' attribute. The method should return a Map with String-typed keys. + 'ref' attribute. The method + should return a Map with String-typed keys. - + @@ -1314,9 +1341,11 @@ Provides a header value for the given header name. Requires - exactly one of the 'ref', 'value', or 'expression' attributes. + exactly one of the 'ref', 'value', or + 'expression' attributes. The 'type' attribute allows for the specification of the expected - type when using a 'value' or 'expression', but it is optional. + type when using a 'value' + or 'expression', but it is optional. @@ -1332,7 +1361,8 @@ Expression to be evaulated at runtime to determine the header value. - The EvaluationContext will include variables for 'payload' and + The EvaluationContext will + include variables for 'payload' and 'headers'. @@ -1375,7 +1405,8 @@ Boolean value to indicate whether this header value should overwrite an - existing header value for the same name. + existing header value for + the same name. @@ -1397,7 +1428,8 @@ Specify one or more header names (as a comma separated list) to - be removed from the MessageHeaders of the Message being handled. + be removed from the + MessageHeaders of the Message being handled. @@ -1406,8 +1438,7 @@ - + Defines a Transformer. @@ -1419,15 +1450,15 @@ Defines a Transformer that converts any Object payload to a String by - invoking its toString() method. + invoking its toString() + method. - + @@ -1439,7 +1470,8 @@ Defines a Transformer that stores a Message and returns a new Message whose - payload is the id of the stored Message. + payload is the id of + the stored Message. @@ -1449,7 +1481,8 @@ Defines a Transformer that accepts a Message whose payload is a UUID and retrieves - the Message associated with that id from a MessageStore if available + the Message + associated with that id from a MessageStore if available (else null). @@ -1468,8 +1501,7 @@ - + @@ -1482,15 +1514,15 @@ Defines a Transformer that serializes any Object payload that implements - Serializable into a byte array. + Serializable into a byte + array. - + @@ -1509,8 +1541,7 @@ - + @@ -1531,14 +1562,12 @@ - + - + @@ -1584,8 +1613,7 @@ - + @@ -1616,8 +1644,7 @@ - + @@ -1641,8 +1668,7 @@ - + @@ -1673,8 +1699,7 @@ ]]> - + @@ -1695,8 +1720,7 @@ - + @@ -1704,8 +1728,7 @@ - + Specify whether a failure to resolve a channel name returned by this @@ -1724,14 +1747,15 @@ - + Reference to the default channel where Messages should be sent if channel - resolution fails to return any channels. If no default channel + resolution fails to + return any channels. If no default channel is - provided, the router will either drop the Message or throw an Exception + provided, the router will either drop the Message or throw an + Exception depending on the value of the "resolution-required" attribute. @@ -1757,7 +1781,8 @@ Specify the maximum amount of time in milliseconds to wait when sending Messages - to the target MessageChannels. By default the send will block + to the target + MessageChannels. By default the send will block indefinitely. @@ -1766,7 +1791,8 @@ Specify whether a failure to send to a single channel should be ignored. - Otherwise MessageDeliveryExceptions will be thrown. + Otherwise + MessageDeliveryExceptions will be thrown. @@ -1782,8 +1808,7 @@ - + Defines a Splitter. @@ -1827,8 +1852,7 @@ - + @@ -1841,8 +1865,7 @@ - + @@ -1855,19 +1878,18 @@ is to use a volatile in-memory store, which means that unprocessed messages will be lost if the - JVM exits. To customize the expiry of incomplete message groups + JVM exits. To + customize the expiry of incomplete message groups configure the message store. - + - + @@ -1891,8 +1913,7 @@ - + @@ -1905,9 +1926,11 @@ The release strategy to use to decide when - messages can be processed. Defaults to a SequenceSizeReleaseStrategy, + messages can be processed. Defaults to a + SequenceSizeReleaseStrategy, releasing all messages once the sequence is complete. - This is mutually exclusive with the release-partial-sequences + This is mutually exclusive with + the release-partial-sequences attribute (either or none can be specified , but not both). @@ -1930,8 +1953,7 @@ - + @@ -1944,13 +1966,13 @@ is to use a volatile in-memory store, which means that unprocessed messages will be lost if the - JVM exits. To customize the expiry of incomplete message groups + JVM exits. To + customize the expiry of incomplete message groups configure the message store. - + @@ -1968,15 +1990,15 @@ Flag to say that partial sequences can be released (e.g. 1-4 of 10). - Defaults to true, so the sequence has to be complete before any messages + Defaults to true, so the + sequence has to be complete before any messages are released. This is mutually exclusive with the release-strategy attribute (either or none can be specified , but not both). - + @@ -2004,10 +2026,8 @@ - - + + @@ -2022,8 +2042,7 @@ - + @@ -2033,24 +2052,21 @@ - + - + - @@ -2068,8 +2084,7 @@ - @@ -2090,8 +2105,7 @@ ]]> - + - A SpEL expression to be evaluated against the input Message as its root object. + A SpEL expression to be evaluated against the input Message as its root object. @@ -2119,8 +2133,7 @@ - + @@ -2131,7 +2144,8 @@ Defines a MessagePublishingInterceptor which allows you to generate messages - as a by-product of method invocations on Spring configured components. + as a by-product of + method invocations on Spring configured components. @@ -2145,8 +2159,7 @@ - + @@ -2155,16 +2168,14 @@ - + - + @@ -2189,7 +2200,8 @@ [REQUIRED] Channel name(s) or patterns. To specify more than one channel use ','  - (e.g., channel-name-pattern="input*, foo, bar") + (e.g., + channel-name-pattern="input*, foo, bar") @@ -2197,8 +2209,10 @@ [OPTIONAL] Specifies the order in which this interceptor will be - added to the existing channel interceptors (if any). - Negative value (e.g., -2) will signify BEFORE existing iinterceptors (if any). Positive value (e.g., 2) + added to the existing channel + interceptors (if any). + Negative value (e.g., -2) will signify BEFORE existing iinterceptors (if any). Positive + value (e.g., 2) will signify AFTER existing interceptors (if any) @@ -2208,7 +2222,7 @@ + ]]> diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests-context.xml index 0ad011ce13..42f6e6e49a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests-context.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java index c2dc4e33ed..2558d23de1 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelWithMessageStoreParserTests.java @@ -56,16 +56,17 @@ public class ChannelWithMessageStoreParserTests { @Test @DirtiesContext - public void testAggregation() throws Exception { + public void testActivatorSendsToPersistentQueue() throws Exception { input.send(createMessage("123", "id1", 3, 1, null)); - assertEquals(1, messageGroupStore.getMessageGroup("id1").size()); handler.getLatch().await(100, TimeUnit.MILLISECONDS); assertEquals("The message payload is not correct", "123", handler.getMessageString()); - assertEquals(0, messageGroupStore.getMessageGroup("id1").size()); + // The group id for buffered messages is the channel name + assertEquals(1, messageGroupStore.getMessageGroup("output").size()); Message result = output.receive(100); assertEquals("hello", result.getPayload()); + assertEquals(0, messageGroupStore.getMessageGroup("output").size()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/InvalidChannelWithMessageStoreParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/InvalidChannelWithMessageStoreParserTests-context.xml new file mode 100644 index 0000000000..0ef3e25c57 --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/InvalidChannelWithMessageStoreParserTests-context.xml @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/InvalidChannelWithMessageStoreParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/InvalidChannelWithMessageStoreParserTests.java new file mode 100644 index 0000000000..2d9993be2a --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/InvalidChannelWithMessageStoreParserTests.java @@ -0,0 +1,41 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.integration.config; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Matchers; +import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * @author Dave Syer + */ +public class InvalidChannelWithMessageStoreParserTests { + + @Rule + public ExpectedException exception = ExpectedException.none(); + + @Test + public void testRefAndStoreIllegal() throws Exception { + exception.expect(BeanDefinitionParsingException.class); + exception.expectMessage(Matchers.contains("'message-store' attribute is not allowed")); + new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); + } + +} diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/TestHandler.java b/spring-integration-core/src/test/java/org/springframework/integration/config/TestHandler.java index f6fd5766fb..3beddc8d3a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/TestHandler.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/TestHandler.java @@ -50,7 +50,7 @@ public class TestHandler { public String handle(Message message) { this.messageString = message.getPayload().toString(); this.latch.countDown(); - return (this.replyMessageText != null) ? this.replyMessageText : null; + return this.replyMessageText; } public String getMessageString() { diff --git a/spring-integration-parent/pom.xml b/spring-integration-parent/pom.xml index 88a019ac99..9e0e1c567e 100644 --- a/spring-integration-parent/pom.xml +++ b/spring-integration-parent/pom.xml @@ -10,6 +10,7 @@ pom UTF-8 + true 2.2 1.1.1 diff --git a/spring-integration-samples/loanshark/.settings/org.eclipse.wst.common.component b/spring-integration-samples/loanshark/.settings/org.eclipse.wst.common.component index 7b21d54e66..c3b12182d2 100644 --- a/spring-integration-samples/loanshark/.settings/org.eclipse.wst.common.component +++ b/spring-integration-samples/loanshark/.settings/org.eclipse.wst.common.component @@ -4,186 +4,6 @@ - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses - - - uses -