|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
|
* Copyright 2002-2014 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. |
|
|
|
@ -28,19 +28,17 @@ import org.springframework.core.task.TaskExecutor;
@@ -28,19 +28,17 @@ import org.springframework.core.task.TaskExecutor;
|
|
|
|
|
import org.springframework.messaging.Message; |
|
|
|
|
import org.springframework.messaging.MessageDeliveryException; |
|
|
|
|
import org.springframework.messaging.MessageHandler; |
|
|
|
|
import org.springframework.messaging.MessagingException; |
|
|
|
|
import org.springframework.messaging.support.MessageBuilder; |
|
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.*; |
|
|
|
|
import static org.junit.Assert.*; |
|
|
|
|
import static org.mockito.BDDMockito.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Tests for {@link ExecutorSubscribableChannel}. |
|
|
|
|
* Unit tests for {@link ExecutorSubscribableChannel}. |
|
|
|
|
* |
|
|
|
|
* @author Phillip Webb |
|
|
|
|
*/ |
|
|
|
|
public class PublishSubscribeChannelTests { |
|
|
|
|
public class ExecutorSubscribableChannelTests { |
|
|
|
|
|
|
|
|
|
@Rule |
|
|
|
|
public ExpectedException thrown = ExpectedException.none(); |
|
|
|
@ -117,20 +115,14 @@ public class PublishSubscribeChannelTests {
@@ -117,20 +115,14 @@ public class PublishSubscribeChannelTests {
|
|
|
|
|
this.channel.send(message); |
|
|
|
|
} |
|
|
|
|
catch (MessageDeliveryException actualException) { |
|
|
|
|
assertThat((RuntimeException) actualException.getCause(), equalTo(ex)); |
|
|
|
|
assertThat(actualException.getCause(), equalTo(ex)); |
|
|
|
|
} |
|
|
|
|
verifyZeroInteractions(secondHandler); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void concurrentModification() throws Exception { |
|
|
|
|
this.channel.subscribe(new MessageHandler() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void handleMessage(Message<?> message) throws MessagingException { |
|
|
|
|
channel.unsubscribe(handler); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.channel.subscribe(message1 -> channel.unsubscribe(handler)); |
|
|
|
|
this.channel.subscribe(this.handler); |
|
|
|
|
this.channel.send(this.message); |
|
|
|
|
verify(this.handler).handleMessage(this.message); |