Polishing
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.messaging.simp.broker;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
@@ -77,8 +77,7 @@ public class SimpleBrokerMessageHandlerTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void subcribePublish() {
|
||||
|
||||
public void subscribePublish() {
|
||||
startSession("sess1");
|
||||
startSession("sess2");
|
||||
|
||||
@@ -103,8 +102,7 @@ public class SimpleBrokerMessageHandlerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subcribeDisconnectPublish() {
|
||||
|
||||
public void subscribeDisconnectPublish() {
|
||||
String sess1 = "sess1";
|
||||
String sess2 = "sess2";
|
||||
|
||||
@@ -308,9 +306,9 @@ public class SimpleBrokerMessageHandlerTests {
|
||||
return connectMessage;
|
||||
}
|
||||
|
||||
private Message<String> createSubscriptionMessage(String sessionId, String subcriptionId, String destination) {
|
||||
private Message<String> createSubscriptionMessage(String sessionId, String subscriptionId, String destination) {
|
||||
SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.create(SimpMessageType.SUBSCRIBE);
|
||||
headers.setSubscriptionId(subcriptionId);
|
||||
headers.setSubscriptionId(subscriptionId);
|
||||
headers.setDestination(destination);
|
||||
headers.setSessionId(sessionId);
|
||||
return MessageBuilder.createMessage("", headers.getMessageHeaders());
|
||||
@@ -330,11 +328,11 @@ public class SimpleBrokerMessageHandlerTests {
|
||||
return MessageBuilder.createMessage(payload, headers.getMessageHeaders());
|
||||
}
|
||||
|
||||
private boolean messageCaptured(String sessionId, String subcriptionId, String destination) {
|
||||
private boolean messageCaptured(String sessionId, String subscriptionId, String destination) {
|
||||
for (Message<?> message : this.messageCaptor.getAllValues()) {
|
||||
SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.wrap(message);
|
||||
if (sessionId.equals(headers.getSessionId())) {
|
||||
if (subcriptionId.equals(headers.getSubscriptionId())) {
|
||||
if (subscriptionId.equals(headers.getSubscriptionId())) {
|
||||
if (destination.equals(headers.getDestination())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,12 +117,10 @@ public class MessageBrokerConfigurationTests {
|
||||
|
||||
AbstractSubscribableChannel channel = context.getBean(
|
||||
"clientInboundChannel", AbstractSubscribableChannel.class);
|
||||
|
||||
assertEquals(3, channel.getInterceptors().size());
|
||||
|
||||
CustomThreadPoolTaskExecutor taskExecutor = context.getBean(
|
||||
"clientInboundChannelExecutor", CustomThreadPoolTaskExecutor.class);
|
||||
|
||||
assertEquals(11, taskExecutor.getCorePoolSize());
|
||||
assertEquals(12, taskExecutor.getMaxPoolSize());
|
||||
assertEquals(13, taskExecutor.getKeepAliveSeconds());
|
||||
@@ -512,7 +510,6 @@ public class MessageBrokerConfigurationTests {
|
||||
assertEquals("123", new String((byte[]) outputMessage.getPayload()));
|
||||
outChannel.messages.clear();
|
||||
|
||||
|
||||
// 3. Send message via broker channel
|
||||
|
||||
SimpMessagingTemplate template = new SimpMessagingTemplate(brokerChannel);
|
||||
|
||||
@@ -49,9 +49,7 @@ import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.SocketUtils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link StompBrokerRelayMessageHandler} running against ActiveMQ.
|
||||
@@ -79,7 +77,7 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setup() throws Exception {
|
||||
logger.debug("Setting up before '" + this.testName.getMethodName() + "'");
|
||||
this.port = SocketUtils.findAvailableTcpPort(61613);
|
||||
this.responseChannel = new ExecutorSubscribableChannel();
|
||||
@@ -116,7 +114,7 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void stop() throws Exception {
|
||||
try {
|
||||
logger.debug("STOMP broker relay stats: " + this.relay.getStatsInfo());
|
||||
this.relay.stop();
|
||||
@@ -170,7 +168,6 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
|
||||
@Test(expected = MessageDeliveryException.class)
|
||||
public void messageDeliveryExceptionIfSystemSessionForwardFails() throws Exception {
|
||||
|
||||
logger.debug("Starting test messageDeliveryExceptionIfSystemSessionForwardFails()");
|
||||
|
||||
stopActiveMqBrokerAndAwait();
|
||||
@@ -181,8 +178,8 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void brokerBecomingUnvailableTriggersErrorFrame() throws Exception {
|
||||
logger.debug("Starting test brokerBecomingUnvailableTriggersErrorFrame()");
|
||||
public void brokerBecomingUnavailableTriggersErrorFrame() throws Exception {
|
||||
logger.debug("Starting test brokerBecomingUnavailableTriggersErrorFrame()");
|
||||
|
||||
String sess1 = "sess1";
|
||||
MessageExchange connect = MessageExchangeBuilder.connect(sess1).build();
|
||||
|
||||
Reference in New Issue
Block a user