Test, Javadoc Cleanup

* Remove an unnecessary test.
* Fix timing in header channel registry test.
* Fix Javadocs in VetoCapableInterceptor
This commit is contained in:
Gary Russell
2014-03-26 09:53:36 -04:00
parent 9998880485
commit 70c43c8eed
3 changed files with 8 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ import org.springframework.messaging.support.ChannelInterceptor;
/**
* {@link ChannelInterceptor}s implementing this interface can veto
* global interception of a particular channel name. Could be used, for example,
* global interception of a particular channel. Could be used, for example,
* when an interceptor itself writes to an output channel (which should
* not be intercepted with this interceptor).
*
@@ -32,6 +32,7 @@ public interface VetoCapableInterceptor {
/**
* @param beanName The channel name.
* @param channel The channel that is about to be intercepted.
* @return false if the intercept wishes to veto the interception.
*/
boolean shouldIntercept(String beanName, ChannelInterceptorAware channel);

View File

@@ -23,7 +23,6 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -53,23 +52,6 @@ public class ChannelInterceptorTests {
private final QueueChannel channel = new QueueChannel();
@Test
public void test() {
final AtomicInteger bar = new AtomicInteger();
for (int i = 0; i < 1000000000; i++) {
List<String> foo = getFoo();
if (foo.size() > 0) {
for (String baz : foo) {
bar.incrementAndGet();
}
}
}
}
protected List<String> getFoo() {
List<String> foo = new ArrayList<String>();
return foo;
}
@Test
public void testPreSendInterceptorReturnsMessage() {

View File

@@ -51,6 +51,7 @@ import org.springframework.messaging.core.DestinationResolutionException;
import org.springframework.messaging.support.ErrorMessage;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -61,6 +62,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class HeaderChannelRegistryTests {
@Autowired
@@ -147,9 +149,11 @@ public class HeaderChannelRegistryTests {
DefaultHeaderChannelRegistry registry = new DefaultHeaderChannelRegistry(50);
registry.setTaskScheduler(this.taskScheduler);
registry.start();
Thread.sleep(200);
String id = (String) registry.channelToChannelName(new DirectChannel());
Thread.sleep(300);
int n = 0;
while (n++ < 100 && registry.channelNameToChannel(id) != null) {
Thread.sleep(100);
}
assertNull(registry.channelNameToChannel(id));
registry.stop();
}