eliminated all compiler warnings throughout all projects
updated pom to emit compiler warnings so that any new ones become obvious
added serialVersionUID to classes that could reasonably need to be serialized (GenericMessage, MessageHeaders, etc)
@SuppressWarnings("serial") on all others
@SuppressWarnings("unused") on private static classes used as spring beans for testing (their methods never get called from java)
eliminated all redundant casting
introducted generics metadata where raw types were still being used
changed public API on several FactoryBeans (by adding <Type> information to 'implements FactoryBean' clause)
This commit is contained in:
3
pom.xml
3
pom.xml
@@ -159,6 +159,9 @@
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
|
||||
package org.springframework.integration.aggregator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.integration.channel.MessageChannelTemplate;
|
||||
@@ -23,8 +28,6 @@ import org.springframework.integration.message.MessageBuilder;
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Base class for MessageGroupProcessor implementations that aggregate the group of Messages into a single Message.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -37,6 +37,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PublisherAnnotationBeanPostProcessor extends ProxyConfig
|
||||
implements BeanPostProcessor, BeanClassLoaderAware, BeanFactoryAware, InitializingBean, Ordered {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -69,7 +69,7 @@ public class BeanFactoryChannelResolver implements ChannelResolver, BeanFactoryA
|
||||
public MessageChannel resolveChannelName(String name) {
|
||||
Assert.state(this.beanFactory != null, "BeanFactory is required");
|
||||
try {
|
||||
return (MessageChannel) this.beanFactory.getBean(name, MessageChannel.class);
|
||||
return this.beanFactory.getBean(name, MessageChannel.class);
|
||||
}
|
||||
catch (BeansException e) {
|
||||
throw new ChannelResolutionException(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -24,6 +24,7 @@ import org.springframework.integration.core.MessagingException;
|
||||
* @author Mark Fisher
|
||||
* @see ChannelResolver
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ChannelResolutionException extends MessagingException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -269,7 +269,7 @@ public class MessageChannelTemplate implements InitializingBean {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "unused"})
|
||||
private static class TemporaryReplyChannel implements PollableChannel {
|
||||
|
||||
private volatile Message<?> message;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ConsumerEndpointFactoryBean
|
||||
implements FactoryBean, BeanFactoryAware, BeanNameAware, InitializingBean, SmartLifecycle {
|
||||
implements FactoryBean<AbstractEndpoint>, BeanFactoryAware, BeanNameAware, InitializingBean, SmartLifecycle {
|
||||
|
||||
private volatile MessageHandler handler;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class ConsumerEndpointFactoryBean
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getObject() throws Exception {
|
||||
public AbstractEndpoint getObject() throws Exception {
|
||||
if (!this.initialized) {
|
||||
this.initializeEndpoint();
|
||||
}
|
||||
@@ -122,8 +122,7 @@ public class ConsumerEndpointFactoryBean
|
||||
Assert.hasText(this.inputChannelName, "inputChannelName is required");
|
||||
Assert.isTrue(this.beanFactory.containsBean(this.inputChannelName),
|
||||
"no such input channel '" + this.inputChannelName + "' for endpoint '" + this.beanName + "'");
|
||||
MessageChannel channel = (MessageChannel)
|
||||
this.beanFactory.getBean(this.inputChannelName, MessageChannel.class);
|
||||
MessageChannel channel = this.beanFactory.getBean(this.inputChannelName, MessageChannel.class);
|
||||
if (channel instanceof SubscribableChannel) {
|
||||
Assert.isNull(this.pollerMetadata, "A poller should not be specified for endpoint '" + this.beanName
|
||||
+ "', since '" + this.inputChannelName + "' is a SubscribableChannel (not pollable).");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -36,8 +36,8 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class SourcePollingChannelAdapterFactoryBean implements FactoryBean, BeanFactoryAware, BeanNameAware,
|
||||
BeanClassLoaderAware, InitializingBean, SmartLifecycle {
|
||||
public class SourcePollingChannelAdapterFactoryBean implements FactoryBean<SourcePollingChannelAdapter>,
|
||||
BeanFactoryAware, BeanNameAware, BeanClassLoaderAware, InitializingBean, SmartLifecycle {
|
||||
|
||||
private volatile MessageSource<?> source;
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean, Bean
|
||||
this.initializeAdapter();
|
||||
}
|
||||
|
||||
public Object getObject() throws Exception {
|
||||
public SourcePollingChannelAdapter getObject() throws Exception {
|
||||
if (this.adapter == null) {
|
||||
this.initializeAdapter();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
*/
|
||||
public class MessagingAnnotationPostProcessor implements BeanPostProcessor, BeanFactoryAware, InitializingBean, Lifecycle, ApplicationListener {
|
||||
public class MessagingAnnotationPostProcessor implements BeanPostProcessor, BeanFactoryAware, InitializingBean, Lifecycle, ApplicationListener<ApplicationEvent> {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Bean
|
||||
private final Map<Class<? extends Annotation>, MethodAnnotationPostProcessor<?>> postProcessors =
|
||||
new HashMap<Class<? extends Annotation>, MethodAnnotationPostProcessor<?>>();
|
||||
|
||||
private final Set<ApplicationListener> listeners = new HashSet<ApplicationListener>();
|
||||
private final Set<ApplicationListener<ApplicationEvent>> listeners = new HashSet<ApplicationListener<ApplicationEvent>>();
|
||||
|
||||
private final Set<Lifecycle> lifecycles = new HashSet<Lifecycle>();
|
||||
|
||||
@@ -186,7 +186,7 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Bean
|
||||
}
|
||||
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
for (ApplicationListener listener : listeners) {
|
||||
for (ApplicationListener<ApplicationEvent> listener : listeners) {
|
||||
try {
|
||||
listener.onApplicationEvent(event);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.integration.config.xml;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
|
||||
@@ -42,6 +42,8 @@ import org.springframework.integration.history.MessageHistory;
|
||||
*/
|
||||
public final class MessageHeaders implements Map<String, Object>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6515612906857332100L;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(MessageHeaders.class);
|
||||
|
||||
public static final String PREFIX = "$";
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.beans.SimpleTypeConverter;
|
||||
import org.springframework.beans.TypeConverter;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.annotation.Gateway;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
@@ -315,18 +314,14 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint implements Factory
|
||||
@Override // guarded by super#lifecycleLock
|
||||
protected void doStart() {
|
||||
for (SimpleMessagingGateway gateway : this.gatewayMap.values()) {
|
||||
if (gateway instanceof Lifecycle) {
|
||||
((Lifecycle) gateway).start();
|
||||
}
|
||||
gateway.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // guarded by super#lifecycleLock
|
||||
protected void doStop() {
|
||||
for (SimpleMessagingGateway gateway : this.gatewayMap.values()) {
|
||||
if (gateway instanceof Lifecycle) {
|
||||
((Lifecycle) gateway).stop();
|
||||
}
|
||||
gateway.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -49,7 +49,7 @@ public class SimpleMessageMapper implements InboundMessageMapper<Object>, Outbou
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
if (object instanceof Message) {
|
||||
if (object instanceof Message<?>) {
|
||||
return (Message<?>) object;
|
||||
}
|
||||
return MessageBuilder.withPayload(object).build();
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ArgumentArrayMessageMapper implements InboundMessageMapper<Object[]
|
||||
Map<String, Object> headers = new HashMap<String, Object>();
|
||||
for (int i = 0; i < this.parameterList.size(); i++) {
|
||||
Object argumentValue = arguments[i];
|
||||
MethodParameter methodParameter = (MethodParameter) this.parameterList.get(i);
|
||||
MethodParameter methodParameter = this.parameterList.get(i);
|
||||
Annotation annotation = this.findMappingAnnotation(methodParameter.getParameterAnnotations());
|
||||
if (annotation != null) {
|
||||
if (annotation.annotationType().equals(Payload.class)) {
|
||||
|
||||
@@ -27,6 +27,8 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class MessageHistoryEvent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1623653800353662107L;
|
||||
|
||||
private final String name;
|
||||
|
||||
private final String type;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -23,6 +23,8 @@ package org.springframework.integration.message;
|
||||
*/
|
||||
public class ErrorMessage extends GenericMessage<Throwable> {
|
||||
|
||||
private static final long serialVersionUID = 6413675958959141186L;
|
||||
|
||||
public ErrorMessage(Throwable payload) {
|
||||
super(payload);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import org.springframework.util.ObjectUtils;
|
||||
*/
|
||||
public class GenericMessage<T> implements Message<T>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3649200745084232821L;
|
||||
|
||||
private final T payload;
|
||||
|
||||
private final MessageHeaders headers;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -21,6 +21,7 @@ import org.springframework.integration.core.Message;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageTimeoutException extends MessageHandlingException {
|
||||
|
||||
public MessageTimeoutException(Message<?> failedMessage, String description, Throwable cause) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -23,6 +23,8 @@ package org.springframework.integration.message;
|
||||
*/
|
||||
public class StringMessage extends GenericMessage<String> {
|
||||
|
||||
private static final long serialVersionUID = -5084164633133229804L;
|
||||
|
||||
public StringMessage(String payload) {
|
||||
super(payload);
|
||||
}
|
||||
|
||||
@@ -73,14 +73,13 @@ public class MapToObjectTransformer extends AbstractPayloadTransformer<Map<?,?>,
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.transformer.AbstractPayloadTransformer#transformPayload(java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Object transformPayload(Map<?,?> payload) throws Exception {
|
||||
Object target = (this.targetClass != null)
|
||||
? BeanUtils.instantiate(this.targetClass)
|
||||
: this.beanFactory.getBean(this.targetBeanName);
|
||||
DataBinder binder = new DataBinder(target);
|
||||
binder.setConversionService(this.beanFactory.getConversionService());
|
||||
binder.bind(new MutablePropertyValues((Map) payload));
|
||||
binder.bind(new MutablePropertyValues(payload));
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -24,6 +24,7 @@ import org.springframework.integration.core.MessagingException;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageTransformationException extends MessagingException {
|
||||
|
||||
public MessageTransformationException(Message<?> message, String description, Throwable cause) {
|
||||
|
||||
@@ -111,7 +111,7 @@ class ObjectToSpelMapBuilder {
|
||||
int i = 0;
|
||||
for (Object arrayElement : arrayElements) {
|
||||
String arrayPropertyPath = propertyPath + "[" + i++ + "]";
|
||||
if (arrayElement instanceof Map) {
|
||||
if (arrayElement instanceof Map<?, ?>) {
|
||||
// last argument is empty because it is not a named property, but an array element
|
||||
this.processMap(context, propertiesMap, (Map<?, ?>) arrayElement, arrayPropertyPath, "");
|
||||
}
|
||||
|
||||
@@ -92,7 +92,6 @@ public class AggregationResendTests {
|
||||
do {
|
||||
replyMessage = reply.receive(waitSeconds);
|
||||
if (null != replyMessage) {
|
||||
System.out.println("Message Received: " + replyMessage);
|
||||
messageCount++;
|
||||
}
|
||||
} while (null != replyMessage);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -164,9 +164,10 @@ public class ChannelInterceptorTests {
|
||||
DirectFieldAccessor cAccessor = new DirectFieldAccessor(channel);
|
||||
Object iList = cAccessor.getPropertyValue("interceptors");
|
||||
DirectFieldAccessor iAccessor = new DirectFieldAccessor(iList);
|
||||
List<PreSendReturnsMessageInterceptor> interceptoList =
|
||||
@SuppressWarnings("unchecked")
|
||||
List<PreSendReturnsMessageInterceptor> interceptorList =
|
||||
(List<PreSendReturnsMessageInterceptor>) iAccessor.getPropertyValue("interceptors");
|
||||
String foo = interceptoList.get(0).getFoo();
|
||||
String foo = interceptorList.get(0).getFoo();
|
||||
assertTrue(StringUtils.hasText(foo));
|
||||
assertEquals("foo", foo);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -21,7 +21,6 @@ import java.util.Map;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -26,12 +26,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.message.MessageSource;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
@@ -69,7 +66,7 @@ public class SourcePollingChannelAdapterFactoryBeanTests {
|
||||
factoryBean.setPollerMetadata(pollerMetadata);
|
||||
factoryBean.setAutoStartup(true);
|
||||
factoryBean.afterPropertiesSet();
|
||||
context.registerEndpoint("testPollingEndpoint", (AbstractEndpoint) factoryBean.getObject());
|
||||
context.registerEndpoint("testPollingEndpoint", factoryBean.getObject());
|
||||
context.refresh();
|
||||
Message<?> message = outputChannel.receive(30000);
|
||||
assertEquals("test", message.getPayload());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -79,11 +79,10 @@ public class WireTapParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void wireTapTimeouts() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"wireTapParserTests.xml", this.getClass());
|
||||
Map<String, WireTap> beans = (Map<String, WireTap>) context.getBeansOfType(WireTap.class);
|
||||
Map<String, WireTap> beans = context.getBeansOfType(WireTap.class);
|
||||
int defaultTimeoutCount = 0;
|
||||
int expectedTimeoutCount = 0;
|
||||
int otherTimeoutCount = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -313,6 +313,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
}
|
||||
|
||||
@ServiceActivator(inputChannel="testChannel")
|
||||
@SuppressWarnings("unused")
|
||||
public void countdown(String input) {
|
||||
this.messageText = input;
|
||||
latch.countDown();
|
||||
@@ -342,6 +343,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
@MessageEndpoint
|
||||
private static class ServiceActivatorAnnotatedBean {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ServiceActivator(inputChannel="inputChannel")
|
||||
public String test(String s) {
|
||||
return s + s;
|
||||
@@ -353,6 +355,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
@MessageEndpoint
|
||||
private static class TransformerAnnotationTestBean {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Transformer(inputChannel="inputChannel", outputChannel="outputChannel")
|
||||
public String transformBefore(String input) {
|
||||
return input.toUpperCase();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -22,7 +22,6 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.message.MessageBuilder;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
@@ -46,24 +45,22 @@ public class DelayerUsageTests {
|
||||
private MessageChannel inputB;
|
||||
@Autowired @Qualifier("outputB1")
|
||||
private PollableChannel outputB1;
|
||||
@Autowired
|
||||
private SampleService sampleHandler;
|
||||
|
||||
@Test
|
||||
public void testDelayWithDefaultScheduler(){
|
||||
long start = System.currentTimeMillis();
|
||||
inputA.send(new StringMessage("Hello"));
|
||||
Message<String> msg = (Message<String>) outputA.receive();
|
||||
outputA.receive();
|
||||
assertTrue((System.currentTimeMillis() - start) >= 1000);
|
||||
}
|
||||
@Test
|
||||
public void testDelayWithDefaultSchedulerCustomDelayHeader(){
|
||||
MessageBuilder builder = MessageBuilder.withPayload("Hello");
|
||||
MessageBuilder<String> builder = MessageBuilder.withPayload("Hello");
|
||||
// set custom delay header
|
||||
builder.setHeader("foo", 2000);
|
||||
long start = System.currentTimeMillis();
|
||||
inputA.send(builder.build());
|
||||
Message<String> msg = (Message<String>) outputA.receive();
|
||||
outputA.receive();
|
||||
assertTrue((System.currentTimeMillis() - start) >= 2000);
|
||||
}
|
||||
@Test
|
||||
@@ -76,13 +73,13 @@ public class DelayerUsageTests {
|
||||
inputB.send(new StringMessage("5"));
|
||||
inputB.send(new StringMessage("6"));
|
||||
inputB.send(new StringMessage("7"));
|
||||
Message<String> msg = (Message<String>) outputB1.receive();
|
||||
msg = (Message<String>) outputB1.receive();
|
||||
msg = (Message<String>) outputB1.receive();
|
||||
msg = (Message<String>) outputB1.receive();
|
||||
msg = (Message<String>) outputB1.receive();
|
||||
msg = (Message<String>) outputB1.receive();
|
||||
msg = (Message<String>) outputB1.receive();
|
||||
outputB1.receive();
|
||||
outputB1.receive();
|
||||
outputB1.receive();
|
||||
outputB1.receive();
|
||||
outputB1.receive();
|
||||
outputB1.receive();
|
||||
outputB1.receive();
|
||||
|
||||
// must execute under 3 seconds, since threadPool is set too 5.
|
||||
// first batch is 5 concurrent invocations on SA, then 2 more
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -127,6 +127,7 @@ public class CorrelationIdTests {
|
||||
assertEquals(correlationIdForTest, reply2.getHeaders().getCorrelationId());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestBean {
|
||||
|
||||
public String upperCase(String input) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -66,6 +66,7 @@ public class ServiceActivatorMethodResolutionTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SingleAnnotationTestBean {
|
||||
|
||||
@ServiceActivator
|
||||
@@ -79,6 +80,7 @@ public class ServiceActivatorMethodResolutionTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class MultipleAnnotationTestBean {
|
||||
|
||||
@ServiceActivator
|
||||
@@ -93,6 +95,7 @@ public class ServiceActivatorMethodResolutionTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SinglePublicMethodTestBean {
|
||||
|
||||
public String upperCase(String s) {
|
||||
@@ -105,6 +108,7 @@ public class ServiceActivatorMethodResolutionTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class MultiplePublicMethodTestBean {
|
||||
|
||||
public String upperCase(String s) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -89,6 +89,7 @@ public class MethodInvokingSelectorTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestBean {
|
||||
|
||||
public boolean acceptString(Message<?> message) {
|
||||
|
||||
@@ -208,7 +208,7 @@ public class ArgumentArrayMessageMapperToMessageTests {
|
||||
public void toMessageWithPayloadAndIllegalHeader() throws Exception {
|
||||
Method method = TestService.class.getMethod("sendPayloadAndIllegalHeader", String.class, String.class);
|
||||
ArgumentArrayMessageMapper mapper = new ArgumentArrayMessageMapper(method);
|
||||
Message<?> message = mapper.toMessage(new Object[] { "test", "foo"});
|
||||
mapper.toMessage(new Object[] { "test", "foo"});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,129 +1,130 @@
|
||||
/*
|
||||
* 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.handler;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hamcrest.Description;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.internal.matchers.TypeSafeMatcher;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.springframework.expression.EvaluationException;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @since 2.0
|
||||
*
|
||||
*/
|
||||
public class ExpressionEvaluatingMessageProcessorTests {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ExpressionEvaluatingMessageProcessorTests.class);
|
||||
|
||||
@Rule
|
||||
public ExpectedException expected = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void testProcessMessage() {
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload");
|
||||
assertEquals("foo", processor.processMessage(new StringMessage("foo")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageWithDollar() {
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers['$id']");
|
||||
StringMessage message = new StringMessage("foo");
|
||||
assertEquals(message.getHeaders().getId(), processor.processMessage(message));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageWithStaticKey() {
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers[headers.ID]");
|
||||
StringMessage message = new StringMessage("foo");
|
||||
assertEquals(message.getHeaders().getId(), processor.processMessage(message));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageBadExpression() {
|
||||
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
|
||||
private Throwable cause;
|
||||
@Override
|
||||
public boolean matchesSafely(Exception item) {
|
||||
logger.debug(item);
|
||||
cause = item.getCause();
|
||||
return cause instanceof EvaluationException;
|
||||
}
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("cause to be EvaluationException but was ").appendValue(cause);
|
||||
}
|
||||
});
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.fixMe()");
|
||||
assertEquals("foo", processor.processMessage(new StringMessage("foo")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageExpressionThrowsRuntimeException() {
|
||||
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
|
||||
private Throwable cause;
|
||||
@Override
|
||||
public boolean matchesSafely(Exception item) {
|
||||
logger.debug(item);
|
||||
cause = item.getCause();
|
||||
return cause instanceof UnsupportedOperationException;
|
||||
}
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("cause to be UnsupportedOperationException but was ").appendValue(cause);
|
||||
}
|
||||
});
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.error()");
|
||||
assertEquals("foo", processor.processMessage(new GenericMessage<ExpressionEvaluatingMessageProcessorTests>(this)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageExpressionThrowsCheckedException() {
|
||||
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
|
||||
private Throwable cause;
|
||||
@Override
|
||||
public boolean matchesSafely(Exception item) {
|
||||
logger.debug(item);
|
||||
cause = item.getCause();
|
||||
return cause instanceof CheckedException;
|
||||
}
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("cause to be CheckedException but was ").appendValue(cause);
|
||||
}
|
||||
});
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.check()");
|
||||
assertEquals("foo", processor.processMessage(new GenericMessage<ExpressionEvaluatingMessageProcessorTests>(this)));
|
||||
}
|
||||
|
||||
public String error() {
|
||||
throw new UnsupportedOperationException("Expected test exception");
|
||||
}
|
||||
|
||||
public String check() throws Exception {
|
||||
throw new CheckedException("Expected test exception");
|
||||
}
|
||||
|
||||
private static final class CheckedException extends Exception {
|
||||
public CheckedException(String string) {
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.handler;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hamcrest.Description;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.internal.matchers.TypeSafeMatcher;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.springframework.expression.EvaluationException;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @since 2.0
|
||||
*
|
||||
*/
|
||||
public class ExpressionEvaluatingMessageProcessorTests {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ExpressionEvaluatingMessageProcessorTests.class);
|
||||
|
||||
@Rule
|
||||
public ExpectedException expected = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void testProcessMessage() {
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload");
|
||||
assertEquals("foo", processor.processMessage(new StringMessage("foo")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageWithDollar() {
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers['$id']");
|
||||
StringMessage message = new StringMessage("foo");
|
||||
assertEquals(message.getHeaders().getId(), processor.processMessage(message));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageWithStaticKey() {
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers[headers.ID]");
|
||||
StringMessage message = new StringMessage("foo");
|
||||
assertEquals(message.getHeaders().getId(), processor.processMessage(message));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageBadExpression() {
|
||||
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
|
||||
private Throwable cause;
|
||||
@Override
|
||||
public boolean matchesSafely(Exception item) {
|
||||
logger.debug(item);
|
||||
cause = item.getCause();
|
||||
return cause instanceof EvaluationException;
|
||||
}
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("cause to be EvaluationException but was ").appendValue(cause);
|
||||
}
|
||||
});
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.fixMe()");
|
||||
assertEquals("foo", processor.processMessage(new StringMessage("foo")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageExpressionThrowsRuntimeException() {
|
||||
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
|
||||
private Throwable cause;
|
||||
@Override
|
||||
public boolean matchesSafely(Exception item) {
|
||||
logger.debug(item);
|
||||
cause = item.getCause();
|
||||
return cause instanceof UnsupportedOperationException;
|
||||
}
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("cause to be UnsupportedOperationException but was ").appendValue(cause);
|
||||
}
|
||||
});
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.error()");
|
||||
assertEquals("foo", processor.processMessage(new GenericMessage<ExpressionEvaluatingMessageProcessorTests>(this)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageExpressionThrowsCheckedException() {
|
||||
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
|
||||
private Throwable cause;
|
||||
@Override
|
||||
public boolean matchesSafely(Exception item) {
|
||||
logger.debug(item);
|
||||
cause = item.getCause();
|
||||
return cause instanceof CheckedException;
|
||||
}
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("cause to be CheckedException but was ").appendValue(cause);
|
||||
}
|
||||
});
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.check()");
|
||||
assertEquals("foo", processor.processMessage(new GenericMessage<ExpressionEvaluatingMessageProcessorTests>(this)));
|
||||
}
|
||||
|
||||
public String error() {
|
||||
throw new UnsupportedOperationException("Expected test exception");
|
||||
}
|
||||
|
||||
public String check() throws Exception {
|
||||
throw new CheckedException("Expected test exception");
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static final class CheckedException extends Exception {
|
||||
public CheckedException(String string) {
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -357,6 +357,7 @@ public class MethodInvokingMessageProcessorTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static final class CheckedException extends Exception {
|
||||
public CheckedException(String string) {
|
||||
super(string);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class InboundJsonMessageMapperTests {
|
||||
String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\"},\"payload\":\"myPayloadStuff\"}";
|
||||
Message<String> expected = MessageBuilder.withPayload("myPayloadStuff").setHeader(MessageHeaders.TIMESTAMP, new Long(1)).setHeader(MessageHeaders.ID, id).build();
|
||||
InboundJsonMessageMapper mapper = new InboundJsonMessageMapper(String.class);
|
||||
Message<String> result = (Message<String>) mapper.toMessage(jsonMessage);
|
||||
Message<?> result = mapper.toMessage(jsonMessage);
|
||||
assertThat(result, sameExceptImmutableHeaders(expected));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -66,6 +66,7 @@ public class MethodInvokingSourceTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestBean {
|
||||
|
||||
public String validMethod() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -52,10 +52,10 @@ public class SpelSplitterIntegrationTests {
|
||||
public void split() {
|
||||
Message<?> message = MessageBuilder.withPayload(new TestBean()).setHeader("foo", "foo").build();
|
||||
this.input.send(message);
|
||||
Message one = output.receive(0);
|
||||
Message two = output.receive(0);
|
||||
Message three = output.receive(0);
|
||||
Message four = output.receive(0);
|
||||
Message<?> one = output.receive(0);
|
||||
Message<?> two = output.receive(0);
|
||||
Message<?> three = output.receive(0);
|
||||
Message<?> four = output.receive(0);
|
||||
assertEquals(new Integer(1), one.getPayload());
|
||||
assertEquals("foo", one.getHeaders().get("foo"));
|
||||
assertEquals(new Integer(2), two.getPayload());
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.integration.transformer;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -63,7 +62,6 @@ public class MapToObjectTransformerTests {
|
||||
assertEquals("Case", person.getLname());
|
||||
assertNull(person.getSsn());
|
||||
assertNotNull(person.getAddress());
|
||||
assertTrue(person.getAddress() instanceof Address);
|
||||
assertEquals("1123 Main st", person.getAddress().getStreet());
|
||||
}
|
||||
|
||||
@@ -108,7 +106,6 @@ public class MapToObjectTransformerTests {
|
||||
assertEquals("Case", person.getLname());
|
||||
assertNull(person.getSsn());
|
||||
assertNotNull(person.getAddress());
|
||||
assertTrue(person.getAddress() instanceof Address);
|
||||
assertEquals("1123 Main st", person.getAddress().getStreet());
|
||||
}
|
||||
|
||||
@@ -133,7 +130,6 @@ public class MapToObjectTransformerTests {
|
||||
assertEquals("Justin", person.getFname());
|
||||
assertEquals("Case", person.getLname());
|
||||
assertNotNull(person.getAddress());
|
||||
assertTrue(person.getAddress() instanceof Address);
|
||||
assertEquals("1123 Main st", person.getAddress().getStreet());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -114,6 +114,7 @@ public class DefaultMethodInvokerTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestBean {
|
||||
|
||||
String lastStringArgument;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.CollectionUtils;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ApplicationEventInboundChannelAdapter extends MessageProducerSupport implements ApplicationListener {
|
||||
public class ApplicationEventInboundChannelAdapter extends MessageProducerSupport implements ApplicationListener<ApplicationEvent> {
|
||||
|
||||
private final List<Class<? extends ApplicationEvent>> eventTypes = new CopyOnWriteArrayList<Class<? extends ApplicationEvent>>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -43,7 +43,7 @@ public class ApplicationEventPublishingMessageHandler<T> extends AbstractMessage
|
||||
@Override
|
||||
protected void handleMessageInternal(Message<?> message) {
|
||||
Assert.notNull(this.applicationEventPublisher, "applicationEventPublisher is required");
|
||||
this.applicationEventPublisher.publishEvent(new MessagingEvent((Message<?>) message));
|
||||
this.applicationEventPublisher.publishEvent(new MessagingEvent(message));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -26,6 +26,8 @@ import org.springframework.integration.core.Message;
|
||||
*/
|
||||
public class MessagingEvent extends ApplicationEvent {
|
||||
|
||||
private static final long serialVersionUID = -872581247155846293L;
|
||||
|
||||
public MessagingEvent(Message<?> message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand
|
||||
if (resultFile != null) {
|
||||
if (originalFileFromHeader == null && payload instanceof File) {
|
||||
return MessageBuilder.withPayload(resultFile)
|
||||
.setHeader(FileHeaders.ORIGINAL_FILE, (File) payload);
|
||||
.setHeader(FileHeaders.ORIGINAL_FILE, payload);
|
||||
}
|
||||
}
|
||||
return resultFile;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.integration.file.PatternMatchingFileListFilter;
|
||||
* @author Mark Fisher
|
||||
* @since 1.0.3
|
||||
*/
|
||||
public class FileListFilterFactoryBean implements FactoryBean {
|
||||
public class FileListFilterFactoryBean implements FactoryBean<FileListFilter> {
|
||||
|
||||
private volatile FileListFilter fileListFilter;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FileListFilterFactoryBean implements FactoryBean {
|
||||
this.preventDuplicates = preventDuplicates;
|
||||
}
|
||||
|
||||
public Object getObject() throws Exception {
|
||||
public FileListFilter getObject() throws Exception {
|
||||
if (this.fileListFilter == null) {
|
||||
synchronized (this.monitor) {
|
||||
this.intializeFileListFilter();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -33,7 +33,7 @@ import java.util.Comparator;
|
||||
* @author Iwein Fuld
|
||||
* @since 1.0.3
|
||||
*/
|
||||
public class FileReadingMessageSourceFactoryBean implements FactoryBean {
|
||||
public class FileReadingMessageSourceFactoryBean implements FactoryBean<FileReadingMessageSource> {
|
||||
|
||||
private static Log logger = LogFactory.getLog(FileReadingMessageSourceFactoryBean.class);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class FileReadingMessageSourceFactoryBean implements FactoryBean {
|
||||
this.locker = locker;
|
||||
}
|
||||
|
||||
public Object getObject() throws Exception {
|
||||
public FileReadingMessageSource getObject() throws Exception {
|
||||
if (this.source == null) {
|
||||
initSource();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -34,7 +34,8 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
* @since 1.0.3
|
||||
*/
|
||||
public class FileWritingMessageHandlerFactoryBean implements FactoryBean, BeanFactoryAware, ResourceLoaderAware {
|
||||
public class FileWritingMessageHandlerFactoryBean implements FactoryBean<FileWritingMessageHandler>,
|
||||
BeanFactoryAware, ResourceLoaderAware {
|
||||
|
||||
private volatile FileWritingMessageHandler handler;
|
||||
|
||||
@@ -117,7 +118,7 @@ public class FileWritingMessageHandlerFactoryBean implements FactoryBean, BeanFa
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public Object getObject() throws Exception {
|
||||
public FileWritingMessageHandler getObject() throws Exception {
|
||||
if (this.handler == null) {
|
||||
initHandler();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -45,7 +45,7 @@ public class FileListFilterFactoryBeanTests {
|
||||
FileListFilterFactoryBean factory = new FileListFilterFactoryBean();
|
||||
TestFilter testFilter = new TestFilter();
|
||||
factory.setFilterReference(testFilter);
|
||||
FileListFilter result = (FileListFilter) factory.getObject();
|
||||
FileListFilter result = factory.getObject();
|
||||
assertFalse(result instanceof CompositeFileListFilter);
|
||||
assertSame(testFilter, result);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class FileListFilterFactoryBeanTests {
|
||||
TestFilter testFilter = new TestFilter();
|
||||
factory.setFilterReference(testFilter);
|
||||
factory.setPreventDuplicates(Boolean.TRUE);
|
||||
FileListFilter result = (FileListFilter) factory.getObject();
|
||||
FileListFilter result = factory.getObject();
|
||||
assertTrue(result instanceof CompositeFileListFilter);
|
||||
Collection filters = (Collection) new DirectFieldAccessor(result).getPropertyValue("fileFilters");
|
||||
assertTrue(filters.iterator().next() instanceof AcceptOnceFileListFilter);
|
||||
@@ -70,7 +70,7 @@ public class FileListFilterFactoryBeanTests {
|
||||
TestFilter testFilter = new TestFilter();
|
||||
factory.setFilterReference(testFilter);
|
||||
factory.setPreventDuplicates(Boolean.FALSE);
|
||||
FileListFilter result = (FileListFilter) factory.getObject();
|
||||
FileListFilter result = factory.getObject();
|
||||
assertFalse(result instanceof CompositeFileListFilter);
|
||||
assertSame(testFilter, result);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class FileListFilterFactoryBeanTests {
|
||||
public void filenamePatternAndPreventDuplicatesNull() throws Exception {
|
||||
FileListFilterFactoryBean factory = new FileListFilterFactoryBean();
|
||||
factory.setFilenamePattern(Pattern.compile("foo"));
|
||||
FileListFilter result = (FileListFilter) factory.getObject();
|
||||
FileListFilter result = factory.getObject();
|
||||
assertTrue(result instanceof CompositeFileListFilter);
|
||||
Collection filters = (Collection) new DirectFieldAccessor(result).getPropertyValue("fileFilters");
|
||||
Iterator<FileListFilter> iterator = filters.iterator();
|
||||
@@ -94,7 +94,7 @@ public class FileListFilterFactoryBeanTests {
|
||||
FileListFilterFactoryBean factory = new FileListFilterFactoryBean();
|
||||
factory.setFilenamePattern(Pattern.compile("foo"));
|
||||
factory.setPreventDuplicates(Boolean.TRUE);
|
||||
FileListFilter result = (FileListFilter) factory.getObject();
|
||||
FileListFilter result = factory.getObject();
|
||||
assertTrue(result instanceof CompositeFileListFilter);
|
||||
Collection filters = (Collection) new DirectFieldAccessor(result).getPropertyValue("fileFilters");
|
||||
Iterator<FileListFilter> iterator = filters.iterator();
|
||||
@@ -107,7 +107,7 @@ public class FileListFilterFactoryBeanTests {
|
||||
FileListFilterFactoryBean factory = new FileListFilterFactoryBean();
|
||||
factory.setFilenamePattern(Pattern.compile("foo"));
|
||||
factory.setPreventDuplicates(Boolean.FALSE);
|
||||
FileListFilter result = (FileListFilter) factory.getObject();
|
||||
FileListFilter result = factory.getObject();
|
||||
assertFalse(result instanceof CompositeFileListFilter);
|
||||
assertTrue(result instanceof PatternMatchingFileListFilter);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -66,7 +66,7 @@ public class NioFileLockerTests {
|
||||
testFile.createNewFile();
|
||||
assertThat(filter1.filterFiles(workdir.listFiles()).get(0), is(testFile));
|
||||
filter1.lock(testFile);
|
||||
assertThat(filter2.filterFiles(workdir.listFiles()), is((List)new ArrayList<File>()));
|
||||
assertThat(filter2.filterFiles(workdir.listFiles()), is((List<File>)new ArrayList<File>()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -31,7 +31,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.matchers.JUnitMatchers.hasItem;
|
||||
import static org.junit.matchers.JUnitMatchers.hasItems;
|
||||
import static org.springframework.integration.test.matcher.PayloadMatcher.hasPayload;
|
||||
|
||||
@@ -60,7 +59,8 @@ public class FileInboundChannelAdapterWithRecursiveDirectoryTests {
|
||||
assertThat(files.receive(), hasPayload(file));
|
||||
}
|
||||
|
||||
@Test(timeout = 2000)
|
||||
@Test(timeout = 2000)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void shouldReturnFilesMultipleLevels() throws IOException {
|
||||
|
||||
//when
|
||||
|
||||
@@ -202,7 +202,7 @@ public class DefaultInboundRequestMapper implements InboundRequestMapper {
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object createPayloadFromMultipartRequest(MultipartHttpServletRequest multipartRequest) {
|
||||
Map<String, Object> payloadMap = new HashMap<String, Object>(multipartRequest.getParameterMap());
|
||||
Map<String, MultipartFile> fileMap = (Map<String, MultipartFile>) multipartRequest.getFileMap();
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
|
||||
MultipartFile multipartFile = entry.getValue();
|
||||
if (multipartFile.isEmpty()) {
|
||||
@@ -300,6 +300,7 @@ public class DefaultInboundRequestMapper implements InboundRequestMapper {
|
||||
* The contents of the map are unmodifiable, so calling any modification operation
|
||||
* (e.g. put, add, or remove) will result in an UnsupportedOperationException.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
private static class UnmodifiableRequestParameterMap
|
||||
extends LinkedMultiValueMap<String, String> implements Serializable { // TODO: in 3.0.1 LMVM implements Serializable
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -187,7 +187,7 @@ public class HttpInboundEndpoint extends SimpleMessagingGateway implements HttpR
|
||||
DefaultInboundRequestMapper defaultMapper = new DefaultInboundRequestMapper();
|
||||
if (this.getBeanFactory() != null) {
|
||||
try {
|
||||
MultipartResolver multipartResolver = (MultipartResolver)
|
||||
MultipartResolver multipartResolver =
|
||||
this.getBeanFactory().getBean(DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME, MultipartResolver.class);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Using MultipartResolver [" + multipartResolver + "]");
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.springframework.remoting.support.RemoteInvocationResult;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class HttpInvokerInboundGatewayTests {
|
||||
|
||||
@Test
|
||||
@@ -104,7 +105,7 @@ public class HttpInvokerInboundGatewayTests {
|
||||
ObjectInputStream ois = new ObjectInputStream(bais);
|
||||
RemoteInvocationResult remoteResult = (RemoteInvocationResult) ois.readObject();
|
||||
Object resultValue = remoteResult.getValue();
|
||||
assertTrue(resultValue instanceof Message);
|
||||
assertTrue(resultValue instanceof Message<?>);
|
||||
return (Message<?>) resultValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -30,6 +30,7 @@ import org.springframework.integration.httpinvoker.HttpInvokerInboundGateway;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class HttpInvokerInboundGatewayParserTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -29,6 +29,7 @@ import org.springframework.integration.httpinvoker.HttpInvokerOutboundGateway;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class HttpInvokerOutboundGatewayParserTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -34,8 +34,6 @@ public abstract class IpHeaders {
|
||||
|
||||
private static final String TCP = IP + "tcp_";
|
||||
|
||||
private static final String UDP = IP + "udp_";
|
||||
|
||||
public static final String HOSTNAME = IP + "hostname";
|
||||
|
||||
public static final String IP_ADDRESS = IP + "address";
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
|
||||
package org.springframework.integration.ip.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.AbstractConsumerEndpointParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for the <outbound-gateway> element of the integration 'jms' namespace.
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.net.Socket;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SocketMessageMapperTests {
|
||||
public void testToMessage() throws Exception {
|
||||
SocketMessageMapper mapper = new SocketMessageMapper();
|
||||
Message<byte[]> message = mapper.toMessage(new StubSocketReader());
|
||||
assertEquals(TEST_PAYLOAD, new String((byte[]) message.getPayload()));
|
||||
assertEquals(TEST_PAYLOAD, new String(message.getPayload()));
|
||||
assertEquals(InetAddress.getLocalHost().getHostName(), message
|
||||
.getHeaders().get(IpHeaders.HOSTNAME));
|
||||
assertEquals(InetAddress.getLocalHost().getHostAddress(), message
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class ChannelPublishingJmsMessageListener implements SessionAwareMessageListener, InitializingBean {
|
||||
public class ChannelPublishingJmsMessageListener implements SessionAwareMessageListener<javax.jms.Message>, InitializingBean {
|
||||
|
||||
private volatile boolean expectReply;
|
||||
|
||||
@@ -238,7 +238,7 @@ public class ChannelPublishingJmsMessageListener implements SessionAwareMessageL
|
||||
|
||||
public void onMessage(javax.jms.Message jmsMessage, Session session) throws JMSException {
|
||||
Object object = this.messageConverter.fromMessage(jmsMessage);
|
||||
Message<?> requestMessage = (object instanceof Message) ?
|
||||
Message<?> requestMessage = (object instanceof Message<?>) ?
|
||||
(Message<?>) object : MessageBuilder.withPayload(object).build();
|
||||
if (!this.expectReply) {
|
||||
boolean sent = this.channelTemplate.send(requestMessage);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -142,7 +142,7 @@ public class HeaderMappingMessageConverter implements MessageConverter {
|
||||
if (conversionResult == null) {
|
||||
return null;
|
||||
}
|
||||
if (conversionResult instanceof Message) {
|
||||
if (conversionResult instanceof Message<?>) {
|
||||
builder = MessageBuilder.fromMessage((Message<?>) conversionResult);
|
||||
}
|
||||
else {
|
||||
@@ -166,7 +166,7 @@ public class HeaderMappingMessageConverter implements MessageConverter {
|
||||
public javax.jms.Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
|
||||
MessageHeaders headers = null;
|
||||
javax.jms.Message jmsMessage = null;
|
||||
if (object instanceof Message) {
|
||||
if (object instanceof Message<?>) {
|
||||
headers = ((Message<?>) object).getHeaders();
|
||||
if (this.extractIntegrationMessagePayload) {
|
||||
object = ((Message<?>) object).getPayload();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
* @since 1.0.3
|
||||
*/
|
||||
public class MailReceiverFactoryBean implements FactoryBean, DisposableBean {
|
||||
public class MailReceiverFactoryBean implements FactoryBean<MailReceiver>, DisposableBean {
|
||||
|
||||
private volatile String storeUri;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class MailReceiverFactoryBean implements FactoryBean, DisposableBean {
|
||||
this.maxFetchSize = maxFetchSize;
|
||||
}
|
||||
|
||||
public Object getObject() throws Exception {
|
||||
public MailReceiver getObject() throws Exception {
|
||||
if (this.receiver == null) {
|
||||
this.receiver = this.createReceiver();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -53,6 +53,7 @@ public class MailReceivingMessageSourceTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class StubMailReceiver implements MailReceiver {
|
||||
|
||||
private final ConcurrentLinkedQueue<javax.mail.Message[]> messages = new ConcurrentLinkedQueue<javax.mail.Message[]>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -112,7 +112,7 @@ public class MailSendingMessageHandlerTests {
|
||||
@Test
|
||||
public void simpleMailMessageOverrideWithHeaders() {
|
||||
SimpleMailMessage mailMessage = MailTestsHelper.createSimpleMailMessage();
|
||||
String[] toHeaders = mailMessage.getTo();
|
||||
mailMessage.getTo();
|
||||
this.handler.handleMessage(MessageBuilder.withPayload(mailMessage).setHeader(MailHeaders.TO, new String[]{"foo@bar.bam"}).build());
|
||||
assertEquals("only one simple message must be sent",
|
||||
1, mailSender.getSentSimpleMailMessages().size());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -48,7 +48,7 @@ public class ChannelInvocation {
|
||||
"MethodInvocation must be on a MessageChannel");
|
||||
this.channel = (MessageChannel) methodInvocation.getThis();
|
||||
if (methodInvocation.getMethod().getName().equals("send")) {
|
||||
if (methodInvocation.getArguments().length < 1 || !(methodInvocation.getArguments()[0] instanceof Message)) {
|
||||
if (methodInvocation.getArguments().length < 1 || !(methodInvocation.getArguments()[0] instanceof Message<?>)) {
|
||||
throw new IllegalStateException("expected a Message as the first parameter of the channel's send method");
|
||||
}
|
||||
this.message = (Message<?>) methodInvocation.getArguments()[0];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -72,7 +72,7 @@ public class SecuredChannelsParser extends AbstractSingleBeanDefinitionParser {
|
||||
private String parseObjectDefinitionSource(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
BASE_PACKAGE_NAME + ".channel.ChannelInvocationDefinitionSource");
|
||||
List<Element> accessPolicyElements = (List<Element>) DomUtils.getChildElementsByTagName(element, "access-policy");
|
||||
List<Element> accessPolicyElements = DomUtils.getChildElementsByTagName(element, "access-policy");
|
||||
ManagedMap patternMappings = new ManagedMap();
|
||||
for (Element accessPolicyElement : accessPolicyElements) {
|
||||
Pattern pattern = Pattern.compile(accessPolicyElement.getAttribute("pattern"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -31,7 +31,6 @@ import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
@@ -41,7 +40,6 @@ import org.springframework.integration.channel.ChannelInterceptor;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.security.channel.ChannelAccessPolicy;
|
||||
import org.springframework.integration.security.channel.ChannelInvocationDefinitionSource;
|
||||
import org.springframework.integration.security.channel.ChannelSecurityInterceptor;
|
||||
import org.springframework.integration.selector.MessageSelector;
|
||||
import org.springframework.security.ConfigAttribute;
|
||||
@@ -165,7 +163,7 @@ public class SecuredChannelsParserTests extends AbstractJUnit4SpringContextTests
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private ChannelAccessPolicy retrievePolicyForPatternString(String patternString, ChannelSecurityInterceptor interceptor) {
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor((ChannelInvocationDefinitionSource) interceptor.obtainObjectDefinitionSource());
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(interceptor.obtainObjectDefinitionSource());
|
||||
Map<Pattern, ChannelAccessPolicy> policies = (Map<Pattern, ChannelAccessPolicy>) accessor.getPropertyValue("patternMappings");
|
||||
for (Map.Entry<Pattern, ChannelAccessPolicy> entry : policies.entrySet()) {
|
||||
if (entry.getKey().pattern().equals(patternString)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* 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.
|
||||
@@ -74,7 +74,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG
|
||||
DOMResult result = new DOMResult();
|
||||
this.getWebServiceTemplate().sendSourceAndReceiveToResult(
|
||||
new DOMSource((Document) requestPayload), requestCallback, result);
|
||||
return (Document)result.getNode();
|
||||
return result.getNode();
|
||||
}
|
||||
throw new MessagingException("Unsupported payload type '" + requestPayload.getClass() +
|
||||
"'. " + this.getClass().getName() + " only supports 'java.lang.String', '" + Source.class.getName() +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* 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.
|
||||
@@ -70,7 +70,7 @@ public class DefaultXmlPayloadConverterTests {
|
||||
|
||||
@Test
|
||||
public void testGetNodePassingNode() {
|
||||
Node element = (Node) testDocument.getElementsByTagName("test").item(0);
|
||||
Node element = testDocument.getElementsByTagName("test").item(0);
|
||||
Node n = converter.convertToNode(element);
|
||||
assertTrue("Wrong node returned", element == n);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class DefaultXmlPayloadConverterTests {
|
||||
|
||||
@Test
|
||||
public void testGetNodePassingDOMSource(){
|
||||
Node element = (Node) testDocument.getElementsByTagName("test").item(0);
|
||||
Node element = testDocument.getElementsByTagName("test").item(0);
|
||||
Node n = converter.convertToNode(new DOMSource(element));
|
||||
assertTrue("Wrong node returned", element == n);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user