INT-1265: fix tests in suite

This commit is contained in:
David Syer
2010-09-03 12:02:59 +00:00
parent 53f975311a
commit 4e7d8da749
17 changed files with 33 additions and 136 deletions

View File

@@ -1,43 +0,0 @@
/*
* 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.control;
/**
* This interface defines the MBean attributes and operations
* to be exposed for any MessageChannel instance.
*
* @author Mark Fisher
* @since 2.0
*/
interface MessageChannelInfo {
/**
* Returns the name of the channel.
*/
String getName();
/**
* Number of Messages that have been sent successfully.
*/
long getSendSuccessCount();
/**
* Number of Messages that have caused Exceptions on send.
*/
long getSendErrorCount();
}

View File

@@ -1,33 +0,0 @@
/*
* 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.control;
/**
* This interface defines the MBean attributes and operations
* to be exposed for any PollableChannel instance.
*
* @author Mark Fisher
* @since 2.0
*/
interface PollableChannelInfo extends MessageChannelInfo {
/**
* Clears all Messages currently held by the channel.
*/
void clear();
}

View File

@@ -1,38 +0,0 @@
/*
* 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.control;
/**
* This interface defines the MBean attributes and operations
* to be exposed for any QueueChannel instance.
*
* @author Mark Fisher
* @since 2.0
*/
interface QueueChannelInfo extends PollableChannelInfo {
/**
* Returns the number of Messages contained within the queue at the time of invocation.
*/
int getQueueSize();
/**
* Returns the remaining capacity of the queue at the time of invocation.
*/
int getRemainingCapacity();
}

View File

@@ -6,5 +6,5 @@ log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m
log4j.category.org.springframework=WARN
log4j.category.org.springframework.integration=DEBUG
log4j.category.org.springframework.integration.monitor=TRACE
#log4j.category.org.springframework.integration=DEBUG
#log4j.category.org.springframework.integration.monitor=TRACE

View File

@@ -1,10 +1,19 @@
package org.springframework.integration;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.springframework.integration.control.ControlBusTests;
import org.springframework.integration.control.ControlBusXmlTests;
import org.springframework.integration.jmx.AttributePollingMessageSourceTests;
import org.springframework.integration.jmx.NotificationListeningMessageProducerTests;
import org.springframework.integration.jmx.OperationInvokingMessageHandlerTests;
import org.springframework.integration.jmx.config.NotificationListeningChannelAdapterParserTests;
import org.springframework.integration.jmx.config.OperationInvokingChannelAdapterParserTests;
import org.springframework.integration.jmx.config.OperationInvokingOutboundGatewayTests;
import org.springframework.integration.monitor.ExponentialMovingAverageCumulativeHistoryTests;
import org.springframework.integration.monitor.ExponentialMovingAverageRatioCumulativeHistoryTests;
import org.springframework.integration.monitor.HandlerMonitoringIntegrationTests;
import org.springframework.integration.monitor.MessageChannelsMonitorIntegrationTests;
/*
@@ -30,8 +39,13 @@ import org.springframework.integration.monitor.MessageChannelsMonitorIntegration
*
*/
@RunWith(Suite.class)
@SuiteClasses(value = { ControlBusXmlTests.class, MessageChannelsMonitorIntegrationTests.class })
@Ignore
@SuiteClasses(value = { OperationInvokingMessageHandlerTests.class,
ExponentialMovingAverageCumulativeHistoryTests.class, OperationInvokingChannelAdapterParserTests.class,
HandlerMonitoringIntegrationTests.class, NotificationListeningMessageProducerTests.class,
OperationInvokingOutboundGatewayTests.class, NotificationListeningChannelAdapterParserTests.class,
ControlBusXmlTests.class, ExponentialMovingAverageRatioCumulativeHistoryTests.class,
AttributePollingMessageSourceTests.class, ControlBusTests.class, MessageChannelsMonitorIntegrationTests.class })
// @Ignore
public class IgnoredTestSuite {
}

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.control;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -40,11 +41,12 @@ import org.springframework.jmx.support.MBeanServerFactoryBean;
public class ControlBusOperationChannelTests {
private final String domain = "domain.test";
private GenericApplicationContext context;
@Test
public void replyProducingOperation() throws Exception {
GenericApplicationContext context = new GenericApplicationContext();
context = new GenericApplicationContext();
RootBeanDefinition endpointDef = new RootBeanDefinition(EventDrivenConsumer.class);
endpointDef.getConstructorArgumentValues().addGenericArgumentValue(new DirectChannel());
endpointDef.getConstructorArgumentValues().addGenericArgumentValue(new RootBeanDefinition(TestHandler.class));
@@ -66,6 +68,11 @@ public class ControlBusOperationChannelTests {
assertFalse("endpoint should have been stopped", endpoint.isRunning());
controlBus.getOperationChannel().send(startMessage);
assertTrue("endpoint should be running after being restarted", endpoint.isRunning());
close();
}
@After
public void close() {
context.close();
}

View File

@@ -16,9 +16,7 @@
<int:bridge input-channel="testDirectChannel" />
<int:bridge id="testPollingBridge" input-channel="testQueueChannel" output-channel="nullChannel">
<int:poller max-messages-per-poll="1">
<int:interval-trigger interval="10000" />
</int:poller>
<int:poller max-messages-per-poll="1" fixed-rate="10000" />
</int:bridge>
<bean id="controlBus" class="org.springframework.integration.control.ControlBus">
@@ -28,6 +26,7 @@
<bean id="mbeanExporter" class="org.springframework.integration.monitor.IntegrationMBeanExporter">
<property name="server" ref="mbeanServer" />
<property name="domain" value="control.bus.xml.test" />
</bean>
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">

View File

@@ -30,7 +30,6 @@ import org.springframework.integration.monitor.LifecycleMessageHandlerMonitor;
import org.springframework.integration.monitor.QueueChannelMonitor;
import org.springframework.integration.monitor.SimpleMessageChannelMonitor;
import org.springframework.jmx.support.ObjectNameManager;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -41,7 +40,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class ControlBusXmlTests {
private static final String DOMAIN = "spring.application";
private static final String DOMAIN = "control.bus.xml.test";
@Autowired
@@ -78,8 +77,6 @@ public class ControlBusXmlTests {
}
@Test
// Assume this one runs last and force MBeans to be unregistered to avoid clashes in later tests
@DirtiesContext
public void pollingConsumerRegistered() throws Exception {
ObjectInstance instance = mbeanServer.getObjectInstance(
ObjectNameManager.getInstance(DOMAIN + ":type=MessageHandler,name=testPollingBridge,bean=endpoint"));

View File

@@ -22,7 +22,6 @@ import javax.management.MBeanServer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@@ -20,7 +20,6 @@ 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.beans.factory.annotation.Qualifier;
import org.springframework.integration.MessageChannel;

View File

@@ -24,7 +24,6 @@ import javax.management.Notification;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.Message;
import org.springframework.integration.core.PollableChannel;

View File

@@ -25,7 +25,6 @@ import javax.management.Notification;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;

View File

@@ -21,7 +21,6 @@ import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;

View File

@@ -23,7 +23,6 @@ import java.util.List;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.MessageChannel;

View File

@@ -13,8 +13,9 @@
<int:bridge id="bridge" input-channel="requests" output-channel="intermediate"/>
<bean id="integrationExecutions" class="org.springframework.integration.monitor.IntegrationMBeanExporter">
<bean id="mbeanExporter" class="org.springframework.integration.monitor.IntegrationMBeanExporter">
<property name="server" ref="mbeanServer" />
<property name="domain" value="test.ChannelIntegrationTests"/>
</bean>
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">

View File

@@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.core.PollableChannel;
import org.springframework.integration.message.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -39,7 +38,6 @@ public class ChannelIntegrationTests {
private IntegrationMBeanExporter messageChannelsMonitor;
@Test
@DirtiesContext
public void testMessageChannelStatistics() throws Exception {
requests.send(new GenericMessage<String>("foo"));

View File

@@ -6,5 +6,6 @@ Import-Template:
org.springframework.integration.*;version="[2.0.0, 2.0.1)",
org.springframework.*;version="[3.0.3, 4.0.0)",
org.apache.commons.logging;version="[1.1.1, 2.0.0)",
org.aopalliance.*;version="[1.0.0, 2.0.0)",
javax.management.*;version="0",
org.w3c.dom.*;version="0"