INT-3665: Remove Deprecations and Resolve Issues

https://jira.spring.io/browse/INT-3665

Fixes according Travis report

Introduce `...ExpressionString(String)` setter

Some further fixes and polishing

Address PR comments
This commit is contained in:
Artem Bilan
2015-08-13 16:10:36 -04:00
committed by Gary Russell
parent 84fdd98428
commit cf528c0b5d
81 changed files with 529 additions and 1168 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2015 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.
@@ -29,6 +29,7 @@ import org.springframework.integration.event.inbound.ApplicationEventListeningMe
* @author Oleg Zhurakousky
* @author Mark Fisher
* @author Gary Russell
* @author Artem Bilan
* @since 2.0
*/
public class EventInboundChannelAdapterParser extends AbstractChannelAdapterParser {
@@ -38,9 +39,10 @@ public class EventInboundChannelAdapterParser extends AbstractChannelAdapterPars
BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder
.rootBeanDefinition(ApplicationEventListeningMessageProducer.class);
adapterBuilder.addPropertyReference("outputChannel", channelName);
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(adapterBuilder, element, "error-channel", "errorChannel");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(adapterBuilder, element, "error-channel");
IntegrationNamespaceUtils.setValueIfAttributeDefined(adapterBuilder, element, "event-types");
IntegrationNamespaceUtils.setValueIfAttributeDefined(adapterBuilder, element, "payload-expression");
IntegrationNamespaceUtils.setValueIfAttributeDefined(adapterBuilder, element, "payload-expression",
"payloadExpressionString");
return adapterBuilder.getBeanDefinition();
}

View File

@@ -44,6 +44,7 @@ import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.ResolvableType;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.integration.channel.DirectChannel;
@@ -61,6 +62,8 @@ import org.springframework.integration.test.util.TestUtils;
*/
public class ApplicationEventListeningMessageProducerTests {
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
@Test
public void anyApplicationEventSentByDefault() {
QueueChannel channel = new QueueChannel();
@@ -135,11 +138,10 @@ public class ApplicationEventListeningMessageProducerTests {
}
@Test
@SuppressWarnings("deprecation")
public void payloadExpressionEvaluatedAgainstApplicationEvent() {
QueueChannel channel = new QueueChannel();
ApplicationEventListeningMessageProducer adapter = new ApplicationEventListeningMessageProducer();
adapter.setPayloadExpression("'received: ' + source");
adapter.setPayloadExpression(PARSER.parseExpression("'received: ' + source"));
adapter.setOutputChannel(channel);
GenericApplicationContext ctx = TestUtils.createTestApplicationContext();