INT-1815 removed size() method in AbstractDispatcher

This commit is contained in:
Oleg Zhurakousky
2011-03-02 09:32:29 -05:00
parent f085a094c8
commit 1514a6e64a
3 changed files with 21 additions and 24 deletions

View File

@@ -24,8 +24,8 @@ import java.util.concurrent.Executor;
import org.apache.commons.logging.Log;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.core.MessageHandler;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.ReflectionUtils.FieldCallback;
@@ -41,9 +41,7 @@ public class P2pChannelTests {
final DirectChannel channel = new DirectChannel();
channel.setBeanName("directChannel");
String logMessage = "Point-to-Point channel '" + channel.getComponentName() + "' has more then 1 subscriber. " +
"If load balancing strategy is provided, messages will be dispatched following its rules.";
final Log logger = mock(Log.class);
ReflectionUtils.doWithFields(AbstractMessageChannel.class, new FieldCallback() {
public void doWith(Field field) throws IllegalArgumentException,
@@ -56,9 +54,9 @@ public class P2pChannelTests {
});
channel.subscribe(mock(MessageHandler.class));
verify(logger, times(0)).info(logMessage);
verify(logger, times(0)).info(Mockito.anyString());
channel.subscribe(mock(MessageHandler.class));
verify(logger, times(1)).info(logMessage);
verify(logger, times(1)).info(Mockito.anyString());
}
@Test
@@ -66,9 +64,6 @@ public class P2pChannelTests {
final ExecutorChannel channel = new ExecutorChannel(mock(Executor.class));
channel.setBeanName("executorChannel");
String logMessage = "Point-to-Point channel '" + channel.getComponentName() + "' has more then 1 subscriber. " +
"If load balancing strategy is provided, messages will be dispatched following its rules.";
final Log logger = mock(Log.class);
ReflectionUtils.doWithFields(AbstractMessageChannel.class, new FieldCallback() {
@@ -81,9 +76,9 @@ public class P2pChannelTests {
}
});
channel.subscribe(mock(MessageHandler.class));
verify(logger, times(0)).info(logMessage);
verify(logger, times(0)).info(Mockito.anyString());
channel.subscribe(mock(MessageHandler.class));
verify(logger, times(1)).info(logMessage);
verify(logger, times(1)).info(Mockito.anyString());
}
@Test
@@ -91,9 +86,6 @@ public class P2pChannelTests {
final PublishSubscribeChannel channel = new PublishSubscribeChannel();
channel.setBeanName("pubSubChannel");
String logMessage = "Point-to-Point channel '" + channel.getComponentName() + "' has more then 1 subscriber. " +
"If load balancing strategy is provided, messages will be dispatched following its rules.";
final Log logger = mock(Log.class);
ReflectionUtils.doWithFields(AbstractMessageChannel.class, new FieldCallback() {
@@ -106,8 +98,8 @@ public class P2pChannelTests {
}
});
channel.subscribe(mock(MessageHandler.class));
verify(logger, times(0)).info(logMessage);
verify(logger, times(0)).info(Mockito.anyString());
channel.subscribe(mock(MessageHandler.class));
verify(logger, times(0)).info(logMessage);
verify(logger, times(0)).info(Mockito.anyString());
}
}