Added tests for DefaultConfiguringBeanFactoryPostProcessor.

This commit is contained in:
Mark Fisher
2009-06-28 02:44:22 +00:00
parent 10fa2c1a41
commit ec6fb22b1c
2 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<!-- triggers bootstrapping of the post-processor -->
<channel id="test"/>
</beans:beans>

View File

@@ -0,0 +1,64 @@
/*
* Copyright 2002-2009 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.config.xml;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.channel.NullChannel;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.scheduling.SimpleTaskScheduler;
import org.springframework.integration.scheduling.TaskScheduler;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Mark Fisher
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class DefaultConfiguringBeanFactoryPostProcessorTests {
@Autowired
private ApplicationContext context;
@Test
public void errorChannelRegistered() {
MessageChannel errorChannel = (MessageChannel) context.getBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME);
assertEquals(PublishSubscribeChannel.class, errorChannel.getClass());
}
@Test
public void nullChannelRegistered() {
MessageChannel nullChannel = (MessageChannel) context.getBean(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME);
assertEquals(NullChannel.class, nullChannel.getClass());
}
@Test
public void taskSchedulerRegistered() {
TaskScheduler taskScheduler = (TaskScheduler) context.getBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME);
assertEquals(SimpleTaskScheduler.class, taskScheduler.getClass());
}
}