Removed ConfigurationException.
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Exception that indicates an incorrectly configured integration component.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ConfigurationException extends RuntimeException {
|
||||
|
||||
public ConfigurationException(String description) {
|
||||
super(description);
|
||||
}
|
||||
|
||||
public ConfigurationException(String description, Throwable cause) {
|
||||
super(description, cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,6 @@ import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.integration.ConfigurationException;
|
||||
import org.springframework.integration.channel.ChannelRegistryAware;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.MessagePublishingErrorHandler;
|
||||
@@ -81,10 +80,8 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
Assert.notNull(applicationContext, "'applicationContext' must not be null");
|
||||
if (applicationContext.getBeanNamesForType(this.getClass()).length > 1) {
|
||||
throw new ConfigurationException("Only one instance of '" + this.getClass().getSimpleName()
|
||||
+ "' is allowed per ApplicationContext.");
|
||||
}
|
||||
Assert.state(!(applicationContext.getBeanNamesForType(this.getClass()).length > 1),
|
||||
"Only one instance of '" + this.getClass().getSimpleName() + "' is allowed per ApplicationContext.");
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.channel.PublishSubscribeChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.config.MessageBusParser;
|
||||
import org.springframework.integration.endpoint.AbstractReplyProducingMessageConsumer;
|
||||
import org.springframework.integration.endpoint.PollingConsumerEndpoint;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
@@ -76,6 +77,7 @@ public class DefaultMessageBusTests {
|
||||
context.refresh();
|
||||
DefaultMessageBus bus = new DefaultMessageBus();
|
||||
bus.setTaskScheduler(TestUtils.createTaskScheduler(10));
|
||||
context.getBeanFactory().registerSingleton(MessageBusParser.MESSAGE_BUS_BEAN_NAME, bus);
|
||||
bus.setApplicationContext(context);
|
||||
consumer.setChannelRegistry(bus);
|
||||
bus.start();
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.context.event.SimpleApplicationEventMulticaster;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.task.SyncTaskExecutor;
|
||||
import org.springframework.integration.ConfigurationException;
|
||||
import org.springframework.integration.bus.DefaultMessageBus;
|
||||
import org.springframework.integration.bus.MessageBus;
|
||||
import org.springframework.integration.bus.MessageBusInterceptorTests;
|
||||
@@ -89,7 +88,7 @@ public class MessageBusParserTests {
|
||||
// tries to get a reference to the message bus
|
||||
assertEquals(BeanCreationException.class, e.getCause().getClass());
|
||||
assertEquals(e.getBeanName(), MessageBusParser.MESSAGE_BUS_AWARE_POST_PROCESSOR_BEAN_NAME);
|
||||
assertEquals(ConfigurationException.class, (e.getCause()).getCause().getClass());
|
||||
assertEquals(IllegalStateException.class, (e.getCause()).getCause().getClass());
|
||||
assertEquals(((BeanCreationException) e.getCause()).getBeanName(), MessageBusParser.MESSAGE_BUS_BEAN_NAME);
|
||||
}
|
||||
assertTrue(exceptionThrown);
|
||||
|
||||
Reference in New Issue
Block a user