polishing - removed all warnings from CORE module

This commit is contained in:
Oleg Zhurakousky
2010-11-09 11:36:49 -05:00
parent d271ca78f6
commit 8da4fae7ef
51 changed files with 74 additions and 66 deletions

View File

@@ -49,7 +49,6 @@ import java.util.concurrent.ConcurrentMap;
* @author Dave Syer
* @since 2.0
*/
@SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"})
public class CorrelatingMessageHandler extends AbstractMessageHandler implements MessageProducer {
private static final Log logger = LogFactory.getLog(CorrelatingMessageHandler.class);
@@ -154,6 +153,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
return "aggregator";
}
@SuppressWarnings("rawtypes")
@Override
protected void handleMessageInternal(Message<?> message) throws Exception {
Object correlationKey = correlationStrategy.getCorrelationKey(message);
@@ -201,6 +201,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
}
}
@SuppressWarnings("rawtypes")
private void cleanUpForReleasedGroup(MessageGroup group, Collection<Message> completedMessages) {
if (group.isComplete() || group.getSequenceSize() == 0) {
// The group is complete or else there is no
@@ -249,6 +250,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
messageStore.markMessageGroup(group);
}
@SuppressWarnings("rawtypes")
private void mark(MessageGroup group, Collection<Message> partialSequence) {
Object id = group.getGroupId();
for (Message message : partialSequence) {
@@ -295,6 +297,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
completeGroup(first, correlationKey, group);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private Collection<Message> completeGroup(Message<?> message, Object correlationKey, MessageGroup group) {
if (logger.isDebugEnabled()) {
logger.debug("Completing group with correlationKey ["
@@ -310,6 +313,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
return partialSequence;
}
@SuppressWarnings("rawtypes")
private void sendReplies(Object processorResult, Message message) {
Object replyChannelHeader = null;
if (message != null) {

View File

@@ -38,6 +38,7 @@ public class ResequencingMessageGroupProcessor implements MessageGroupProcessor
this.comparator = comparator;
}
@SuppressWarnings("rawtypes")
public Object processMessageGroup(MessageGroup group) {
Collection<Message<?>> messages = group.getUnmarked();

View File

@@ -108,7 +108,7 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Bean
return bean;
}
ReflectionUtils.doWithMethods(beanClass, new ReflectionUtils.MethodCallback() {
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
Annotation[] annotations = AnnotationUtils.getAnnotations(method);
for (Annotation annotation : annotations) {

View File

@@ -38,8 +38,8 @@ import org.springframework.util.xml.DomUtils;
*/
public abstract class AbstractChannelParser extends AbstractBeanDefinitionParser {
@SuppressWarnings("rawtypes")
@Override
@SuppressWarnings("unchecked")
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = this.buildBeanDefinition(element, parserContext);
ManagedList interceptors = null;

View File

@@ -38,7 +38,7 @@ import org.springframework.beans.factory.xml.ParserContext;
public class ChainParser extends AbstractConsumerEndpointParser {
@Override
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder
.genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".handler.MessageHandlerChain");

View File

@@ -48,7 +48,7 @@ public class ChannelInterceptorParser {
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public ManagedList parseInterceptors(Element element, ParserContext parserContext) {
ManagedList interceptors = new ManagedList();
NodeList childNodes = element.getChildNodes();

View File

@@ -61,7 +61,7 @@ public abstract class HeaderEnricherParserSupport extends AbstractTransformerPar
}
@Override
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void parseTransformer(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
ManagedMap headers = new ManagedMap();
this.processHeaders(element, headers, parserContext);

View File

@@ -39,7 +39,7 @@ import org.springframework.util.xml.DomUtils;
public class RecipientListRouterParser extends AbstractConsumerEndpointParser {
@Override
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
BeanDefinitionBuilder recipientListRouterBuilder = BeanDefinitionBuilder.genericBeanDefinition(
IntegrationNamespaceUtils.BASE_PACKAGE + ".router.RecipientListRouter");

View File

@@ -54,7 +54,7 @@ public class SelectorChainParser extends AbstractSingleBeanDefinitionParser {
this.parseSelectorChain(builder, element, parserContext);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
private void parseSelectorChain(BeanDefinitionBuilder builder, Element element, ParserContext parserContext) {
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "voting-strategy");
ManagedList selectors = new ManagedList();

View File

@@ -152,6 +152,7 @@ class OrderedAwareLinkedHashSet<E> extends LinkedHashSet<E> {
}
}
@SuppressWarnings("rawtypes")
private boolean addOrderedElement(Ordered adding) {
boolean added = false;
E[] tempUnorderedElements = (E[]) this.toArray();

View File

@@ -36,6 +36,7 @@ import org.springframework.util.StringUtils;
* @author Mark Fisher
* @since 2.0
*/
@SuppressWarnings("serial")
public class MessageHistory implements List<Properties>, Serializable {
public static final String HEADER_NAME = MessageHeaders.PREFIX + "history";
@@ -206,7 +207,6 @@ public class MessageHistory implements List<Properties>, Serializable {
/**
* Inner class for each Entry in the history.
*/
@SuppressWarnings("serial")
public static class Entry extends Properties {
public String getName() {

View File

@@ -19,11 +19,8 @@ package org.springframework.integration.router;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

View File

@@ -44,8 +44,8 @@ public abstract class AbstractMessageSplitter extends AbstractReplyProducingMess
this.applySequence = applySequence;
}
@SuppressWarnings("rawtypes")
@Override
@SuppressWarnings("unchecked")
protected final Object handleRequestMessage(Message<?> message) {
Object result = this.splitMessage(message);
// return null if 'null', empty Collection or empty Array
@@ -78,7 +78,7 @@ public abstract class AbstractMessageSplitter extends AbstractReplyProducingMess
return messageBuilders;
}
@SuppressWarnings( { "unchecked" })
@SuppressWarnings( { "unchecked", "rawtypes" })
private MessageBuilder createBuilder(Object item, MessageHeaders headers, Object correlationId, int sequenceNumber,
int sequenceSize) {
MessageBuilder builder;

View File

@@ -108,7 +108,7 @@ public class HeaderEnricher implements Transformer {
}
}
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
private void addHeadersFromMessageProcessor(Message<?> message, Map<String, Object> headerMap) {
if (this.messageProcessor != null) {
Object result = this.messageProcessor.processMessage(message);

View File

@@ -21,7 +21,6 @@ import java.util.Map;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.util.Assert;

View File

@@ -23,7 +23,6 @@ import org.springframework.beans.SimpleTypeConverter;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.ConversionServiceFactory;

View File

@@ -21,7 +21,7 @@ public class ExpressionEvaluatingReleaseStrategyTests {
private SimpleMessageGroup messages = new SimpleMessageGroup("foo");
@Before
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setup() {
for (int i = 0; i < 5; i++) {
messages.add(new GenericMessage(i + 1));

View File

@@ -75,7 +75,7 @@ public class ResequencerTests {
@Test
public void testBasicResequencingWithCustomComparator() throws InterruptedException {
this.processor.setComparator(new Comparator<Message<?>>() {
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public int compare(Message<?> o1, Message<?> o2) {
return ((Comparable)o1.getPayload()).compareTo(o2.getPayload());
}
@@ -153,7 +153,7 @@ public class ResequencerTests {
public void testResequencingWithPartialSequenceAndComparator() throws InterruptedException {
this.resequencer.setReleaseStrategy(new SequenceSizeReleaseStrategy(true));
this.processor.setComparator(new Comparator<Message<?>>() {
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public int compare(Message<?> o1, Message<?> o2) {
return ((Comparable)o1.getPayload()).compareTo(o2.getPayload());
}

View File

@@ -18,6 +18,7 @@ public class ResequencingMessageGroupProcessorTest {
private ResequencingMessageGroupProcessor processor = new ResequencingMessageGroupProcessor();
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void shouldProcessSequence() {
Message prototypeMessage = MessageBuilder.withPayload("foo").setCorrelationId("x").setSequenceNumber(1).setSequenceSize(3).build();
@@ -33,6 +34,7 @@ public class ResequencingMessageGroupProcessorTest {
assertThat(processedMessages, hasItems(message1, message2, message3));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void shouldPartiallProcessIncompleteSequence() {
Message prototypeMessage = MessageBuilder.withPayload("foo").setCorrelationId("x").setSequenceNumber(1).setSequenceSize(4).build();

View File

@@ -19,7 +19,6 @@ package org.springframework.integration.aggregator.integration;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;

View File

@@ -52,7 +52,7 @@ public class DefaultMessageAggregatorIntegrationTests {
@Qualifier("output")
private PollableChannel output;
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test(timeout = 10000)
public void testAggregation() throws Exception {
for (int i = 0; i < 5; i++) {

View File

@@ -70,8 +70,6 @@ public class AggregatorReplyChannelTests {
this.verifyReply(MessageBuilder.withPayload(list).setReplyChannelName("output").build());
}
@SuppressWarnings("unchecked")
private void verifyReply(Message<?> message) {
assertNull(output.receive(0));
input.send(message);

View File

@@ -46,6 +46,7 @@ public class PartialSequencesWithGapsTests {
@Autowired
SubscribableChannel out;
@SuppressWarnings("rawtypes")
Queue<Message> received = new ArrayBlockingQueue<Message>(10);
@Before

View File

@@ -158,8 +158,8 @@ public class ChainParserTests {
assertThat(reply, sameExceptImmutableHeaders(successMessage));
}
@SuppressWarnings("rawtypes")
@Test
@SuppressWarnings("unchecked")
public void chainNestingAndAggregation() throws Exception {
Message<?> message = MessageBuilder.withPayload("test").setCorrelationId(1).setSequenceSize(1).build();
this.aggregatorInput.send(message);

View File

@@ -134,6 +134,7 @@ public class ResequencerParserTests {
.getClass());
}
@SuppressWarnings("unused")
private static <T> Message<T> createMessage(T payload, Object correlationId, int sequenceSize, int sequenceNumber,
MessageChannel outputChannel) {
return MessageBuilder.withPayload(payload).setCorrelationId(correlationId).setSequenceSize(sequenceSize)
@@ -155,7 +156,7 @@ public class ResequencerParserTests {
}
static class TestComparator implements Comparator<Message<?>> {
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public int compare(Message<?> o1, Message<?> o2) {
return ((Comparable) o1.getPayload()).compareTo(o2.getPayload());
}

View File

@@ -79,6 +79,7 @@ public class SourcePollingChannelAdapterFactoryBeanTests {
assertTrue("adviceChain was not applied", adviceApplied.get());
}
@SuppressWarnings("rawtypes")
@Test
public void testTransactionalAdviceChain() throws Throwable {
SourcePollingChannelAdapterFactoryBean factoryBean = new SourcePollingChannelAdapterFactoryBean();

View File

@@ -59,7 +59,7 @@ public class MapToObjectTransformerParserTests {
@Qualifier("outputA")
private PollableChannel outputA;
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testMapToObjectTransformationWithType(){
Map map = new HashMap();
@@ -83,7 +83,7 @@ public class MapToObjectTransformerParserTests {
assertEquals("1123 Main st", person.getAddress().getStreet());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testMapToObjectTransformationWithRef(){
Map map = new HashMap();
@@ -106,7 +106,7 @@ public class MapToObjectTransformerParserTests {
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testMapToObjectTransformationWithConversionService(){
Map map = new HashMap();

View File

@@ -91,7 +91,7 @@ public class ObjectToMapTransformerParserTests {
directInput.send(message);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public Employee buildEmployee(){
Address companyAddress = new Address();
companyAddress.setCity("Philadelphia");

View File

@@ -22,9 +22,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -45,7 +43,6 @@ import org.springframework.integration.mapping.OutboundMessageMapper;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.scheduling.PollerMetadata;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
import org.springframework.integration.support.channel.ChannelResolutionException;
import org.springframework.integration.support.channel.ChannelResolver;
import org.springframework.integration.support.converter.SimpleMessageConverter;

View File

@@ -34,6 +34,7 @@ public class OrderedAwareLinkedHashSetTests {
/**
* Tests that semantics of the LinkedHashSet were not broken
*/
@SuppressWarnings("rawtypes")
@Test
public void testAddUnordered(){
OrderedAwareLinkedHashSet setToTest = new OrderedAwareLinkedHashSet();
@@ -54,6 +55,7 @@ public class OrderedAwareLinkedHashSetTests {
* the already existing element, thus preserving the order of insertion (LinkedHashset semantics)
* within the elements that have the same "order" value.
*/
@SuppressWarnings("rawtypes")
@Test
public void testAddOrdered(){
OrderedAwareLinkedHashSet setToTest = new OrderedAwareLinkedHashSet();
@@ -91,6 +93,7 @@ public class OrderedAwareLinkedHashSetTests {
assertEquals(o6, elements[9]);
}
@SuppressWarnings("rawtypes")
@Test
public void testAddAllOrderedUnordered(){
List tempList = new ArrayList();
@@ -136,6 +139,7 @@ public class OrderedAwareLinkedHashSetTests {
this.doConcurrent();
}
}
@SuppressWarnings("rawtypes")
private void doConcurrent(){
final OrderedAwareLinkedHashSet setToTest = new OrderedAwareLinkedHashSet();
final Object o1 = new Foo(3);
@@ -199,6 +203,7 @@ public class OrderedAwareLinkedHashSetTests {
this.doConcurrentAll();
}
}
@SuppressWarnings("rawtypes")
public void doConcurrentAll(){
final List tempList = new ArrayList();
Object o1 = new Foo(3);

View File

@@ -5,8 +5,6 @@ package org.springframework.integration.dispatcher;
import static junit.framework.Assert.assertTrue;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.context.ApplicationContext;

View File

@@ -22,9 +22,7 @@ import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.common.LiteralExpression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.integration.Message;
/**
@@ -33,8 +31,6 @@ import org.springframework.integration.Message;
*/
public class ExpressionEvaluatingMessageSourceTests {
private static final ExpressionParser parser = new SpelExpressionParser();
@Test
public void literalExpression() {

View File

@@ -60,8 +60,10 @@ public class PollingConsumerEndpointTests {
private TestConsumer consumer = new TestConsumer();
@SuppressWarnings("rawtypes")
private Message message = new GenericMessage<String>("test");
@SuppressWarnings("rawtypes")
private Message badMessage = new GenericMessage<String>("bad");
private TestErrorHandler errorHandler = new TestErrorHandler();

View File

@@ -31,8 +31,8 @@ import org.springframework.integration.message.ErrorMessage;
*/
public class PollingEndpointErrorHandlingTests {
@SuppressWarnings("rawtypes")
@Test
@SuppressWarnings("unchecked")
public void checkExceptionPlacedOnErrorChannel() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"pollingEndpointErrorHandlingTests.xml", this.getClass());

View File

@@ -18,14 +18,12 @@ package org.springframework.integration.endpoint;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static org.easymock.EasyMock.reset;
import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.junit.Before;

View File

@@ -58,6 +58,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
public ExpectedException expected = ExpectedException.none();
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessage() {
Expression expression = expressionParser.parseExpression("payload");
@@ -65,6 +66,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals("foo", processor.processMessage(new GenericMessage<String>("foo")));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithParameterCoercion() {
@SuppressWarnings("unused")
@@ -80,6 +82,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals("2", processor.processMessage(new GenericMessage<String>("2")));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithVoidResult() {
@SuppressWarnings("unused")
@@ -94,6 +97,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals(null, processor.processMessage(new GenericMessage<String>("2")));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithParameterCoercionToNonPrimitive() {
class TestTarget {
@@ -112,6 +116,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertTrue("Wrong result: "+result, result.contains("log4j.properties"));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithDollarInBrackets() {
Expression expression = expressionParser.parseExpression("headers['$foo_id']");
@@ -120,6 +125,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals("abc", processor.processMessage(message));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithDollarPropertyAccess() {
Expression expression = expressionParser.parseExpression("headers.$foo_id");
@@ -128,6 +134,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals("xyz", processor.processMessage(message));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithStaticKey() {
Expression expression = expressionParser.parseExpression("headers[headers.ID]");
@@ -136,6 +143,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals(message.getHeaders().getId(), processor.processMessage(message));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithBeanAsMethodArgument() {
StaticApplicationContext context = new StaticApplicationContext();
@@ -149,6 +157,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals("foobar", processor.processMessage(message));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageWithMethodCallOnBean() {
StaticApplicationContext context = new StaticApplicationContext();
@@ -161,7 +170,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
GenericMessage<String> message = new GenericMessage<String>("foo");
assertEquals("barfoo", processor.processMessage(message));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageBadExpression() {
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
@@ -180,7 +189,8 @@ public class ExpressionEvaluatingMessageProcessorTests {
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor(expression);
assertEquals("foo", processor.processMessage(new GenericMessage<String>("foo")));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageExpressionThrowsRuntimeException() {
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {
@@ -200,6 +210,7 @@ public class ExpressionEvaluatingMessageProcessorTests {
assertEquals("foo", processor.processMessage(new GenericMessage<TestPayload>(new TestPayload())));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testProcessMessageExpressionThrowsCheckedException() {
expected.expect(new TypeSafeMatcher<Exception>(Exception.class) {

View File

@@ -34,6 +34,7 @@ import org.springframework.integration.transformer.HeaderEnricher;
*/
public class MethodInvokingHeaderEnricherTests {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void emptyHeadersOnRequest() {
TestBean testBean = new TestBean();
@@ -47,6 +48,7 @@ public class MethodInvokingHeaderEnricherTests {
assertEquals("ABC", result.getHeaders().get("bar"));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void overwriteFalseByDefault() {
TestBean testBean = new TestBean();
@@ -59,6 +61,7 @@ public class MethodInvokingHeaderEnricherTests {
assertEquals("XYZ", result.getHeaders().get("bar"));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void overwriteFalseExplicit() {
TestBean testBean = new TestBean();
@@ -72,6 +75,7 @@ public class MethodInvokingHeaderEnricherTests {
assertEquals("XYZ", result.getHeaders().get("bar"));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void overwriteTrue() {
TestBean testBean = new TestBean();

View File

@@ -40,6 +40,7 @@ import static org.junit.Assert.*;
* @author Iwein Fuld
* @author Oleg Zhurakousky
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class MethodInvokingMessageProcessorAnnotationTests {
private final TestService testService = new TestService();
@@ -171,7 +172,6 @@ public class MethodInvokingMessageProcessorAnnotationTests {
}
@Test
@SuppressWarnings("unchecked")
public void fromMessageWithMapMethodAndHeadersAnnotation() throws Exception {
Method method = TestService.class.getMethod("mapHeaders", Map.class);
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(testService, method);
@@ -184,7 +184,6 @@ public class MethodInvokingMessageProcessorAnnotationTests {
}
@Test
@SuppressWarnings("unchecked")
public void fromMessageWithMapMethodAndMapPayload() throws Exception {
Method method = TestService.class.getMethod("mapPayload", Map.class);
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(testService, method);

View File

@@ -46,6 +46,7 @@ import org.springframework.integration.support.MessageBuilder;
* @author Oleg Zhurakousky
* @author Dave Syer
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class MethodInvokingMessageProcessorTests {
private static final Log logger = LogFactory.getLog(MethodInvokingMessageProcessorTests.class);
@@ -471,7 +472,6 @@ public class MethodInvokingMessageProcessorTests {
return properties;
}
@SuppressWarnings("unchecked")
public Map mapMethod(Map map) {
return map;
}

View File

@@ -42,6 +42,7 @@ import org.springframework.integration.support.MessageBuilder;
* @author Mark Fisher
* @since 1.0.3
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class PayloadAndHeaderMappingTests {
private TestBean bean;
@@ -700,7 +701,7 @@ public class PayloadAndHeaderMappingTests {
}
}
@SuppressWarnings({"unchecked", "unused"})
@SuppressWarnings("unused")
private static class TestBean {
private volatile Map lastHeaders;

View File

@@ -31,7 +31,6 @@ import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.ErrorMessage;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
/**
* @author Mark Fisher

View File

@@ -16,12 +16,10 @@
package org.springframework.integration.router;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import org.junit.Test;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.ManagedMap;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.support.StaticApplicationContext;
@@ -30,7 +28,6 @@ import org.springframework.integration.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
import org.springframework.integration.support.channel.ChannelResolver;
/**
@@ -90,7 +87,7 @@ public class HeaderValueRouterTests {
}
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void resolveChannelNameFromMap() {
StaticApplicationContext context = new StaticApplicationContext();
ManagedMap channelMap = new ManagedMap();
@@ -112,7 +109,7 @@ public class HeaderValueRouterTests {
assertSame(message, result);
}
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void resolveChannelNameFromMapAndCustomeResolver() {
final StaticApplicationContext context = new StaticApplicationContext();
ManagedMap channelMap = new ManagedMap();

View File

@@ -23,14 +23,12 @@ import static org.mockito.Mockito.mock;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.Message;
import org.springframework.integration.MessagingException;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.channel.TestChannelResolver;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
import org.springframework.util.CollectionUtils;
/**

View File

@@ -70,6 +70,7 @@ public class PayloadTypeRouterParserTests {
reader.loadBeanDefinitions(new InputStreamResource(stream));
}
@SuppressWarnings("unused")
private String routerConfigFakeType =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<beans:beans xmlns=\"http://www.springframework.org/schema/integration\"" +

View File

@@ -24,13 +24,11 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;

View File

@@ -61,6 +61,7 @@ public class MessageStoreTests {
private static class TestMessageStore extends AbstractMessageGroupStore {
@SuppressWarnings("unchecked")
MessageGroup testMessages = new SimpleMessageGroup(Arrays.asList(new GenericMessage<String>("foo")), "bar");
private boolean removed = false;

View File

@@ -147,8 +147,8 @@ public abstract class TestUtils {
}
}
@SuppressWarnings("unchecked")
public static MessageHandler handlerExpecting(final Matcher<Message> messageMatcher) {
@SuppressWarnings("rawtypes")
public static MessageHandler handlerExpecting(final Matcher<Message> messageMatcher) {
return new MessageHandler() {
public void handleMessage(Message<?> message) throws MessageRejectedException, MessageHandlingException, MessageDeliveryException {
assertThat(message, is(messageMatcher));

View File

@@ -26,8 +26,6 @@ import java.util.Map;
import org.junit.Test;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.ConversionServiceFactory;
@@ -39,9 +37,10 @@ import org.springframework.integration.support.MessageBuilder;
* @author Oleg Zhurakousky
* @since 2.0
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public class MapToObjectTransformerTests {
@SuppressWarnings("unchecked")
@Test
public void testMapToObjectTransformation(){
Map map = new HashMap();
@@ -65,7 +64,6 @@ public class MapToObjectTransformerTests {
assertEquals("1123 Main st", person.getAddress().getStreet());
}
@SuppressWarnings("unchecked")
@Test
public void testMapToObjectTransformationWithPrototype(){
Map map = new HashMap();
@@ -90,7 +88,6 @@ public class MapToObjectTransformerTests {
assertEquals("1123 Main st", person.getAddress().getStreet());
}
@SuppressWarnings("unchecked")
@Test
public void testMapToObjectTransformationWithConversionService(){
Map map = new HashMap();

View File

@@ -212,6 +212,7 @@ public class MethodInvokingTransformerTests {
assertNull(result);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test // this changed in 2.0 see INT-785 and INT-1130
public void headerEnricherConfiguredWithMethodReference() throws Exception {
TestBean testBean = new TestBean();
@@ -230,6 +231,7 @@ public class MethodInvokingTransformerTests {
assertEquals("baz", result.getHeaders().get("prop3"));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test // this changed in 2.0 see INT-785 and INT-1130
public void headerEnricherConfiguredWithMethodName() throws Exception {
TestBean testBean = new TestBean();

View File

@@ -74,7 +74,7 @@ public class ObjectToMapTransformerTests {
transformer.transform(message);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public Employee buildEmployee(){
Address companyAddress = new Address();
companyAddress.setCity("Philadelphia");

View File

@@ -17,6 +17,7 @@ import org.springframework.core.convert.TypeDescriptor;
*/
public class BeanFactoryTypeConverterTests {
@SuppressWarnings("unchecked")
@Test
public void testEmptyCollectionConversion(){
BeanFactoryTypeConverter typeConverter = new BeanFactoryTypeConverter();