MessageHandlingException and MessageDeliveryException now require the failed/undelivered Message as a constructor argument.

This commit is contained in:
Mark Fisher
2008-04-09 00:18:56 +00:00
parent f6756da3c8
commit fec6dec258
153 changed files with 458 additions and 476 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.message;
package org.springframework.integration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -26,6 +26,8 @@ import java.util.Set;
import org.junit.Test;
import org.springframework.integration.message.MessageHeader;
/**
* @author Mark Fisher
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,7 +23,7 @@ import java.util.Collection;
import org.junit.Test;
import org.springframework.integration.MessagingException;
import org.springframework.integration.message.MessagingException;
/**
* @author Mark Fisher

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.integration.MessagingException;
import org.springframework.integration.message.MessagingException;
/**
* @author Mark Fisher

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,7 +29,7 @@ import org.junit.Test;
import org.springframework.integration.channel.SimpleChannel;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageHandlingException;
import org.springframework.integration.message.MessagingException;
/**
* @author Mark Fisher
@@ -96,7 +96,7 @@ public class PollingSourceAdapterTests {
assertNull("message should be null", message4);
}
@Test(expected=MessageHandlingException.class)
@Test(expected=MessagingException.class)
public void testResultSizeExceedsLimit() {
TestSource source = new TestSource("testing", 3);
SimpleChannel channel = new SimpleChannel();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,7 +29,7 @@ import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.adapter.PollableSource;
import org.springframework.integration.adapter.PollingSourceAdapter;
import org.springframework.integration.adapter.SourceAdapter;
@@ -228,7 +228,7 @@ public class MessageBusTests {
}
catch (BeanCreationException e) {
exceptionThrown = true;
assertEquals(MessagingConfigurationException.class, e.getCause().getClass());
assertEquals(ConfigurationException.class, e.getCause().getClass());
}
assertTrue(exceptionThrown);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -263,7 +263,7 @@ public class ChannelParserTests {
channel.send(new StringMessage("wrong type"));
}
catch (MessageDeliveryException e) {
assertEquals("wrong type", e.getUndeliveredMessage().getPayload());
assertEquals("wrong type", e.getFailedMessage().getPayload());
threwException = true;
}
assertTrue(threwException);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,7 +26,7 @@ import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.bus.MessageBus;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.handler.TestHandlers;
@@ -55,7 +55,7 @@ public class MessageBusParserTests {
assertNotNull("bus should have created a default error channel", bus.getErrorChannel());
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testAutoCreateChannelsDisabledByDefault() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"messageBusWithDefaults.xml", this.getClass());
@@ -84,7 +84,7 @@ public class MessageBusParserTests {
}
catch (BeanDefinitionStoreException e) {
exceptionThrown = true;
assertEquals(MessagingConfigurationException.class, e.getCause().getClass());
assertEquals(ConfigurationException.class, e.getCause().getClass());
}
assertTrue(exceptionThrown);
}
@@ -97,7 +97,7 @@ public class MessageBusParserTests {
}
catch (BeanCreationException e) {
exceptionThrown = true;
assertEquals(MessagingConfigurationException.class, e.getCause().getClass());
assertEquals(ConfigurationException.class, e.getCause().getClass());
}
assertTrue(exceptionThrown);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -166,7 +166,7 @@ public class DefaultMessageDispatcherTests {
dispatcher.addHandler(new ConcurrentHandler(handler2, createExecutor()) {
@Override
public Message<?> handle(Message<?> message) {
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.addHandler(new ConcurrentHandler(handler3, createExecutor()));
@@ -198,7 +198,7 @@ public class DefaultMessageDispatcherTests {
dispatcher.addHandler(new MessageHandler() {
public Message<?> handle(Message<?> message) {
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.addHandler(handler2);
@@ -251,7 +251,7 @@ public class DefaultMessageDispatcherTests {
public Message<?> handle(Message<?> message) {
rejectedCounter1.incrementAndGet();
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.addHandler(new ConcurrentHandler(handler2, createExecutor()) {
@@ -259,7 +259,7 @@ public class DefaultMessageDispatcherTests {
public Message<?> handle(Message<?> message) {
rejectedCounter2.incrementAndGet();
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.start();
@@ -295,7 +295,7 @@ public class DefaultMessageDispatcherTests {
public Message<?> handle(Message<?> message) {
rejectedCounter1.incrementAndGet();
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.addHandler(new ConcurrentHandler(handler2, createExecutor()) {
@@ -306,7 +306,7 @@ public class DefaultMessageDispatcherTests {
}
rejectedCounter2.incrementAndGet();
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.addHandler(new ConcurrentHandler(handler3, createExecutor()) {
@@ -314,7 +314,7 @@ public class DefaultMessageDispatcherTests {
public Message<?> handle(Message<?> message) {
rejectedCounter3.incrementAndGet();
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.start();
@@ -352,7 +352,7 @@ public class DefaultMessageDispatcherTests {
}
rejectedCounter1.incrementAndGet();
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.addHandler(new ConcurrentHandler(handler2, createExecutor()) {
@@ -363,7 +363,7 @@ public class DefaultMessageDispatcherTests {
}
rejectedCounter2.incrementAndGet();
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
});
dispatcher.start();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -466,7 +466,7 @@ public class DefaultMessageEndpointTests {
Throwable error = errorHandler.getLastError();
assertNotNull(error);
assertEquals(MessageDeliveryException.class, error.getClass());
assertEquals("test2", ((MessageDeliveryException) error).getUndeliveredMessage().getPayload());
assertEquals("test2", ((MessageDeliveryException) error).getFailedMessage().getPayload());
}
@Test
@@ -491,7 +491,7 @@ public class DefaultMessageEndpointTests {
Throwable error = errorHandler.getLastError();
assertNotNull(error);
assertEquals(MessageDeliveryException.class, error.getClass());
assertEquals(message2, ((MessageDeliveryException) error).getUndeliveredMessage());
assertEquals(message2, ((MessageDeliveryException) error).getFailedMessage());
}
@Test
@@ -519,7 +519,7 @@ public class DefaultMessageEndpointTests {
Throwable error = errorHandler.getLastError();
assertNotNull(error);
assertEquals(MessageDeliveryException.class, error.getClass());
assertEquals(message2, ((MessageDeliveryException) error).getUndeliveredMessage());
assertEquals(message2, ((MessageDeliveryException) error).getFailedMessage());
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,6 @@ import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.StringMessage;
import org.springframework.integration.router.SplitterMessageHandlerAdapter;
import org.springframework.integration.util.SimpleMethodInvoker;
/**
* @author Mark Fisher
@@ -84,7 +83,7 @@ public class CorrelationIdTests {
message.getHeader().setCorrelationId(correlationId);
AbstractMessageHandlerAdapter<TestBean> adapter = new AbstractMessageHandlerAdapter<TestBean>() {
@Override
protected Object doHandle(Message<?> message, SimpleMethodInvoker<TestBean> invoker) {
protected Object doHandle(Message<?> message, HandlerMethodInvoker<TestBean> invoker) {
Object result = invoker.invokeMethod(message.getPayload());
Message<?> resultMessage = new GenericMessage<Object>(result);
resultMessage.getHeader().setCorrelationId("456-XYZ");
@@ -103,7 +102,7 @@ public class CorrelationIdTests {
Message<?> message = new StringMessage("test");
AbstractMessageHandlerAdapter<TestBean> adapter = new AbstractMessageHandlerAdapter<TestBean>() {
@Override
protected Object doHandle(Message<?> message, SimpleMethodInvoker<TestBean> invoker) {
protected Object doHandle(Message<?> message, HandlerMethodInvoker<TestBean> invoker) {
Object result = invoker.invokeMethod(message.getPayload());
Message<?> resultMessage = new GenericMessage<Object>(result);
resultMessage.getHeader().setCorrelationId("456-XYZ");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -35,7 +35,7 @@ public class MessageHandlerChainTests {
chain.add(new TestHandler("b"));
chain.add(new TestHandler("c"));
chain.add(new TestHandler("d"));
Message result = chain.handle(new StringMessage(1, "!"));
Message<?> result = chain.handle(new StringMessage(1, "!"));
assertEquals("!abcd", result.getPayload());
}
@@ -49,7 +49,7 @@ public class MessageHandlerChainTests {
chain.add(new TestHandler("a"));
chain.add(handler4);
chain.add(new TestHandler("b"));
Message result = chain.handle(new StringMessage(1, "!"));
Message<?> result = chain.handle(new StringMessage(1, "!"));
assertEquals("234!a*234b", result.getPayload());
}
@@ -62,7 +62,7 @@ public class MessageHandlerChainTests {
this.text = text;
}
public Message handle(Message message) {
public Message<?> handle(Message<?> message) {
return new StringMessage(1, message.getPayload() + text);
}
}
@@ -77,7 +77,7 @@ public class MessageHandlerChainTests {
this.text = text;
}
public Message handle(Message message, MessageHandler target) {
public Message<?> handle(Message<?> message, MessageHandler target) {
message = target.handle(new StringMessage(1, text + message.getPayload()));
return new StringMessage(1, message.getPayload() + text);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -46,7 +46,7 @@ public abstract class TestHandlers {
public final static MessageHandler rejectingHandler() {
return new MessageHandler() {
public Message<?> handle(Message<?> message) {
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
};
}
@@ -59,7 +59,7 @@ public abstract class TestHandlers {
return new MessageHandler() {
public Message<?> handle(Message<?> message) {
latch.countDown();
throw new MessageHandlerRejectedExecutionException();
throw new MessageHandlerRejectedExecutionException(message);
}
};
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,9 +21,9 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.integration.MessagingException;
import org.springframework.integration.message.ErrorMessage;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.MessagingException;
import org.springframework.integration.message.StringMessage;
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -25,7 +25,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
@@ -88,50 +88,50 @@ public class AggregatorAdapterTests {
Assert.assertEquals(123456789l, returnedMessge.getPayload());
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testAdapterWithWrongMethodName() {
new AggregatorAdapter(simpleAggregator, "methodThatDoesNotExist");
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testInvalidParameterTypeUsingMethodName() {
new AggregatorAdapter(simpleAggregator, "invalidParameterType");
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testTooManyParametersUsingMethodName() {
new AggregatorAdapter(simpleAggregator, "tooManyParameters");
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testNotEnoughParametersUsingMethodName() {
new AggregatorAdapter(simpleAggregator, "notEnoughParameters");
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testCollectionSubclassParameterUsingMethodName() {
new AggregatorAdapter(simpleAggregator, "collectionSubclassParameter");
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testInvalidParameterTypeUsingMethodObject() throws SecurityException, NoSuchMethodException {
new AggregatorAdapter(simpleAggregator, simpleAggregator.getClass().getMethod(
"invalidParameterType", String.class));
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testTooManyParametersUsingMethodObject() throws SecurityException, NoSuchMethodException {
new AggregatorAdapter(simpleAggregator, simpleAggregator.getClass().getMethod(
"tooManyParameters", Collection.class, Collection.class));
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testNotEnoughParametersUsingMethodObject() throws SecurityException, NoSuchMethodException {
new AggregatorAdapter(simpleAggregator, simpleAggregator.getClass().getMethod(
"notEnoughParameters", new Class[] {} ));
}
@Test(expected= MessagingConfigurationException.class)
@Test(expected= ConfigurationException.class)
public void testCollectionSubclassParameterUsingMethodObject() throws SecurityException, NoSuchMethodException {
new AggregatorAdapter(simpleAggregator, simpleAggregator.getClass().getMethod(
"collectionSubclassParameter", new Class[] {List.class} ));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,7 +23,8 @@ import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
@@ -88,7 +89,7 @@ public class MultiChannelRouterTests {
assertEquals("test", result2.getPayload());
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testConfiguringBothChannelResolverAndChannelNameResolverIsNotAllowed() {
MultiChannelResolver channelResolver = new MultiChannelResolver() {
public List<MessageChannel> resolve(Message<?> message) {
@@ -168,7 +169,7 @@ public class MultiChannelRouterTests {
router.handle(message);
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testChannelRegistryIsRequiredWhenUsingChannelNameResolver() {
MultiChannelNameResolver channelNameResolver = new MultiChannelNameResolver() {
public String[] resolve(Message<?> message) {
@@ -180,7 +181,7 @@ public class MultiChannelRouterTests {
router.resolveChannels(new StringMessage("this should fail"));
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testValidateChannelRegistryIsPresentWhenUsingChannelNameResolver() {
MultiChannelNameResolver channelNameResolver = new MultiChannelNameResolver() {
public String[] resolve(Message<?> message) {
@@ -192,7 +193,7 @@ public class MultiChannelRouterTests {
router.afterPropertiesSet();
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testChannelResolverIsRequired() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
MultiChannelRouter router = new MultiChannelRouter();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -25,7 +25,7 @@ import java.util.List;
import org.junit.Test;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
@@ -99,7 +99,7 @@ public class RecipientListRouterTests {
assertNull(result2);
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testConfigurationExceptionWhenBothChannelsAndNamesAreProvided() {
SimpleChannel channel1 = new SimpleChannel();
SimpleChannel channel2 = new SimpleChannel();

View File

@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.junit.Test;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.ChannelRegistryAware;
import org.springframework.integration.channel.DefaultChannelRegistry;
@@ -114,7 +114,7 @@ public class RouterMessageHandlerAdapterTests {
assertEquals("bar", message3.getPayload());
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testFailsWhenPropertyAndAttributeAreBothProvided() throws Exception {
SingleChannelNameRoutingTestBean testBean = new SingleChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routePayload", String.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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,7 @@ import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
@@ -74,7 +74,7 @@ public class SingleChannelRouterTests {
assertEquals("test", result.getPayload());
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testConfiguringBothChannelResolverAndChannelNameResolverIsNotAllowed() {
ChannelResolver channelResolver = new ChannelResolver() {
public MessageChannel resolve(Message<?> message) {
@@ -154,7 +154,7 @@ public class SingleChannelRouterTests {
router.handle(message);
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testChannelRegistryIsRequiredWhenUsingChannelNameResolver() {
ChannelNameResolver channelNameResolver = new ChannelNameResolver() {
public String resolve(Message<?> message) {
@@ -166,7 +166,7 @@ public class SingleChannelRouterTests {
router.resolveChannels(new StringMessage("this should fail"));
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testValidateChannelRegistryIsPresentWhenUsingChannelNameResolver() {
ChannelNameResolver channelNameResolver = new ChannelNameResolver() {
public String resolve(Message<?> message) {
@@ -178,7 +178,7 @@ public class SingleChannelRouterTests {
router.afterPropertiesSet();
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testChannelResolverIsRequired() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
SingleChannelRouter router = new SingleChannelRouter();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.
@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.junit.Test;
import org.springframework.integration.MessagingConfigurationException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.SimpleChannel;
@@ -159,7 +159,7 @@ public class SplitterMessageHandlerAdapterTests {
assertEquals("bar", reply2.getPayload());
}
@Test(expected=MessagingConfigurationException.class)
@Test(expected=ConfigurationException.class)
public void testInvalidReturnType() throws Exception {
Method splittingMethod = this.testBean.getClass().getMethod("invalidParameterCount", String.class, String.class);
SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(testBean, splittingMethod, attribs);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 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.