use of org.springframework.messaging.StubMessageChannel in project spring-framework by spring-projects.
the class GenericMessagingTemplateTests method setup.
@BeforeEach
public void setup() {
this.messageChannel = new StubMessageChannel();
this.template = new GenericMessagingTemplate();
this.template.setDefaultDestination(this.messageChannel);
this.template.setDestinationResolver(new TestDestinationResolver());
this.executor = new ThreadPoolTaskExecutor();
this.executor.afterPropertiesSet();
}
use of org.springframework.messaging.StubMessageChannel in project spring-framework by spring-projects.
the class StompBrokerRelayMessageHandlerTests method setup.
@BeforeEach
void setup() {
this.outboundChannel = new StubMessageChannel();
this.brokerRelay = new StompBrokerRelayMessageHandler(new StubMessageChannel(), this.outboundChannel, new StubMessageChannel(), Collections.singletonList("/topic")) {
@Override
protected void startInternal() {
// Force this, since we'll never actually connect
publishBrokerAvailableEvent();
super.startInternal();
}
};
this.tcpClient = new StubTcpOperations();
this.brokerRelay.setTcpClient(this.tcpClient);
this.brokerRelay.setTaskScheduler(mock(TaskScheduler.class));
}
use of org.springframework.messaging.StubMessageChannel in project spring-framework by spring-projects.
the class StompBrokerRelayRegistrationTests method test.
@Test
public void test() {
SubscribableChannel inChannel = new StubMessageChannel();
MessageChannel outChannel = new StubMessageChannel();
String[] prefixes = new String[] { "/foo", "/bar" };
StompBrokerRelayRegistration registration = new StompBrokerRelayRegistration(inChannel, outChannel, prefixes);
registration.setClientLogin("clientlogin");
registration.setClientPasscode("clientpasscode");
registration.setSystemLogin("syslogin");
registration.setSystemPasscode("syspasscode");
registration.setSystemHeartbeatReceiveInterval(123);
registration.setSystemHeartbeatSendInterval(456);
registration.setVirtualHost("example.org");
StompBrokerRelayMessageHandler handler = registration.getMessageHandler(new StubMessageChannel());
assertThat(StringUtils.toStringArray(handler.getDestinationPrefixes())).isEqualTo(prefixes);
assertThat(handler.getClientLogin()).isEqualTo("clientlogin");
assertThat(handler.getClientPasscode()).isEqualTo("clientpasscode");
assertThat(handler.getSystemLogin()).isEqualTo("syslogin");
assertThat(handler.getSystemPasscode()).isEqualTo("syspasscode");
assertThat(handler.getSystemHeartbeatReceiveInterval()).isEqualTo(123);
assertThat(handler.getSystemHeartbeatSendInterval()).isEqualTo(456);
assertThat(handler.getVirtualHost()).isEqualTo("example.org");
}
use of org.springframework.messaging.StubMessageChannel in project spring-framework by spring-projects.
the class StompBrokerRelayMessageHandlerIntegrationTests method createAndStartRelay.
private void createAndStartRelay() throws InterruptedException {
StubMessageChannel channel = new StubMessageChannel();
List<String> prefixes = Arrays.asList("/queue/", "/topic/");
this.relay = new StompBrokerRelayMessageHandler(channel, this.responseChannel, channel, prefixes);
this.relay.setRelayPort(this.port);
this.relay.setApplicationEventPublisher(this.eventPublisher);
this.relay.setSystemHeartbeatReceiveInterval(0);
this.relay.setSystemHeartbeatSendInterval(0);
this.relay.setPreservePublishOrder(true);
this.relay.start();
this.eventPublisher.expectBrokerAvailabilityEvent(true);
}
use of org.springframework.messaging.StubMessageChannel in project spring-framework by spring-projects.
the class SimpMessagingTemplateTests method setup.
@BeforeEach
public void setup() {
this.messageChannel = new StubMessageChannel();
this.messagingTemplate = new SimpMessagingTemplate(this.messageChannel);
}
Aggregations