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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user