Best Citrus code snippet using com.consol.citrus.channel.ChannelSyncConsumer
Source:ChannelEndpointSyncConsumerTest.java
...59 .setReplyChannel(replyChannel)60 .build();61 reset(messagingTemplate, channel, replyChannel);62 when(messagingTemplate.receive(channel)).thenReturn(message);63 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();64 Message receivedMessage = channelSyncConsumer.receive(context);65 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());66 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.ID), message.getHeaders().getId());67 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL), message.getHeaders().getReplyChannel());68 MessageChannel savedReplyChannel = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),69 endpoint.getEndpointConfiguration().getTimeout());70 Assert.assertNotNull(savedReplyChannel);71 Assert.assertEquals(savedReplyChannel, replyChannel);72 verify(messagingTemplate).setReceiveTimeout(5000L);73 }74 75 @Test76 @SuppressWarnings({ "unchecked", "rawtypes" })77 public void testReceiveMessageChannelNameResolver() {78 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();79 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);80 endpoint.getEndpointConfiguration().setChannelName("testChannel");81 endpoint.getEndpointConfiguration().setChannelResolver(channelResolver);82 83 Map<String, Object> headers = new HashMap<String, Object>();84 final org.springframework.messaging.Message message = MessageBuilder.withPayload("<TestResponse>Hello World!</TestResponse>")85 .copyHeaders(headers)86 .setReplyChannel(replyChannel)87 .build();88 reset(messagingTemplate, channel, replyChannel, channelResolver);89 90 when(channelResolver.resolveDestination("testChannel")).thenReturn(channel);91 when(messagingTemplate.receive(channel)).thenReturn(message);92 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();93 Message receivedMessage = channelSyncConsumer.receive(context);94 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());95 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.ID), message.getHeaders().getId());96 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL), message.getHeaders().getReplyChannel());97 MessageChannel savedReplyChannel = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),98 endpoint.getEndpointConfiguration().getTimeout());99 Assert.assertNotNull(savedReplyChannel);100 Assert.assertEquals(savedReplyChannel, replyChannel);101 verify(messagingTemplate).setReceiveTimeout(5000L);102 }103 104 @Test105 @SuppressWarnings({ "unchecked", "rawtypes" })106 public void testReceiveMessageWithReplyChannelName() {107 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();108 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);109 endpoint.getEndpointConfiguration().setChannel(channel);110 111 BeanFactory factory = Mockito.mock(BeanFactory.class);112 endpoint.getEndpointConfiguration().setBeanFactory(factory);113 114 Map<String, Object> headers = new HashMap<String, Object>();115 final org.springframework.messaging.Message message = MessageBuilder.withPayload("<TestResponse>Hello World!</TestResponse>")116 .copyHeaders(headers)117 .setReplyChannelName("replyChannel")118 .build();119 reset(messagingTemplate, channel, replyChannel, factory);120 121 when(messagingTemplate.receive(channel)).thenReturn(message);122 when(factory.getBean("replyChannel", MessageChannel.class)).thenReturn(replyChannel);123 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();124 Message receivedMessage = channelSyncConsumer.receive(context);125 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());126 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.ID), message.getHeaders().getId());127 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL), "replyChannel");128 MessageChannel savedReplyChannel = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),129 endpoint.getEndpointConfiguration().getTimeout());130 Assert.assertNotNull(savedReplyChannel);131 Assert.assertEquals(savedReplyChannel, replyChannel);132 verify(messagingTemplate).setReceiveTimeout(5000L);133 }134 135 @Test136 @SuppressWarnings({ "unchecked", "rawtypes" })137 public void testReceiveMessageWithCustomTimeout() {138 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();139 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);140 endpoint.getEndpointConfiguration().setChannel(channel);141 endpoint.getEndpointConfiguration().setTimeout(10000L);142 143 Map<String, Object> headers = new HashMap<String, Object>();144 final org.springframework.messaging.Message message = MessageBuilder.withPayload("<TestResponse>Hello World!</TestResponse>")145 .copyHeaders(headers)146 .setReplyChannel(replyChannel)147 .build();148 reset(messagingTemplate, channel, replyChannel);149 when(messagingTemplate.receive(channel)).thenReturn(message);150 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();151 Message receivedMessage = channelSyncConsumer.receive(context);152 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());153 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.ID), message.getHeaders().getId());154 MessageChannel savedReplyChannel = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),155 endpoint.getEndpointConfiguration().getTimeout());156 Assert.assertNotNull(savedReplyChannel);157 Assert.assertEquals(savedReplyChannel, replyChannel);158 verify(messagingTemplate).setReceiveTimeout(10000L);159 }160 161 @Test162 @SuppressWarnings({ "unchecked", "rawtypes" })163 public void testReceiveMessageWithReplyMessageCorrelator() {164 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();165 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);166 endpoint.getEndpointConfiguration().setChannel(channel);167 endpoint.getEndpointConfiguration().setCorrelator(messageCorrelator);168 endpoint.getEndpointConfiguration().setTimeout(500L);169 endpoint.getEndpointConfiguration().setPollingInterval(100);170 171 Map<String, Object> headers = new HashMap<String, Object>();172 final org.springframework.messaging.Message message = MessageBuilder.withPayload("<TestResponse>Hello World!</TestResponse>")173 .copyHeaders(headers)174 .setReplyChannel(replyChannel)175 .build();176 reset(messagingTemplate, channel, replyChannel, messageCorrelator);177 178 when(messagingTemplate.receive(channel)).thenReturn(message);179 when(messageCorrelator.getCorrelationKey(any(Message.class))).thenReturn(MessageHeaders.ID + " = '123456789'");180 when(messageCorrelator.getCorrelationKeyName(any(String.class))).thenReturn("correlationKeyName");181 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();182 Message receivedMessage = channelSyncConsumer.receive(context);183 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());184 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.ID), message.getHeaders().getId());185 Assert.assertNull(channelSyncConsumer.getCorrelationManager().find("", endpoint.getEndpointConfiguration().getTimeout()));186 Assert.assertNull(channelSyncConsumer.getCorrelationManager().find(MessageHeaders.ID + " = 'totally_wrong'",187 endpoint.getEndpointConfiguration().getTimeout()));188 MessageChannel savedReplyChannel = channelSyncConsumer.getCorrelationManager().find(MessageHeaders.ID + " = '123456789'",189 endpoint.getEndpointConfiguration().getTimeout());190 Assert.assertNotNull(savedReplyChannel);191 Assert.assertEquals(savedReplyChannel, replyChannel);192 verify(messagingTemplate).setReceiveTimeout(500L);193 }194 195 @Test196 public void testReceiveNoMessage() {197 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();198 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);199 endpoint.getEndpointConfiguration().setChannel(channel);200 201 reset(messagingTemplate, channel, replyChannel);202 203 when(messagingTemplate.receive(channel)).thenReturn(null);204 try {205 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();206 channelSyncConsumer.receive(context);207 } catch(ActionTimeoutException e) {208 Assert.assertTrue(e.getLocalizedMessage().startsWith("Action timeout while receiving message from channel"));209 return;210 }211 Assert.fail("Missing " + ActionTimeoutException.class + " because no message was received");212 verify(messagingTemplate).setReceiveTimeout(5000L);213 }214 215 @Test216 @SuppressWarnings({ "unchecked", "rawtypes" })217 public void testReceiveMessageNoReplyChannel() {218 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();219 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);220 endpoint.getEndpointConfiguration().setChannel(channel);221 endpoint.getEndpointConfiguration().setTimeout(500L);222 endpoint.getEndpointConfiguration().setPollingInterval(150L);223 224 Map<String, Object> headers = new HashMap<String, Object>();225 final org.springframework.messaging.Message message = MessageBuilder.withPayload("<TestResponse>Hello World!</TestResponse>")226 .copyHeaders(headers)227 .build();228 reset(messagingTemplate, channel, replyChannel);229 when(messagingTemplate.receive(channel)).thenReturn(message);230 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();231 Message receivedMessage = channelSyncConsumer.receive(context);232 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());233 Assert.assertEquals(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.ID), message.getHeaders().getId());234 MessageChannel savedReplyChannel = channelSyncConsumer.getCorrelationManager().find("", endpoint.getEndpointConfiguration().getTimeout());235 Assert.assertNull(savedReplyChannel);236 verify(messagingTemplate).setReceiveTimeout(500L);237 }238 @Test239 public void testSendReplyMessage() {240 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();241 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);242 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");243 reset(messagingTemplate, replyChannel);244 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();245 channelSyncConsumer.saveReplyMessageChannel(new DefaultMessage("").setHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL, replyChannel), context);246 channelSyncConsumer.send(message, context);247 verify(messagingTemplate).send(eq(replyChannel), any(org.springframework.messaging.Message.class));248 }249 @Test250 public void testSendReplyMessageWithReplyMessageCorrelator() {251 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();252 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);253 MessageCorrelator correlator = new DefaultMessageCorrelator();254 endpoint.getEndpointConfiguration().setCorrelator(correlator);255 Message request = new DefaultMessage("").setHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL, replyChannel);256 ((ChannelSyncConsumer)endpoint.createConsumer()).getCorrelationManager().saveCorrelationKey(257 endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKeyName(endpoint.createConsumer().getName()),258 request.getId(), context);259 Map<String, Object> headers = new HashMap<String, Object>();260 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>", headers);261 reset(messagingTemplate, replyChannel);262 doAnswer(new Answer() {263 @Override264 public Object answer(InvocationOnMock invocation) throws Throwable {265 Assert.assertEquals(((GenericMessage)invocation.getArguments()[1]).getPayload(), message.getPayload());266 return null;267 }268 }).when(messagingTemplate).send(eq(replyChannel), any(org.springframework.messaging.Message.class));269 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();270 channelSyncConsumer.saveReplyMessageChannel(request, context);271 channelSyncConsumer.send(message, context);272 }273 @Test274 public void testSendReplyMessageWithMissingCorrelatorKey() {275 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();276 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);277 MessageCorrelator correlator = new DefaultMessageCorrelator();278 endpoint.getEndpointConfiguration().setCorrelator(correlator);279 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");280 try {281 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();282 channelSyncConsumer.send(message, context);283 } catch(CitrusRuntimeException e) {284 Assert.assertTrue(e.getMessage().startsWith("Failed to get correlation key for"), e.getMessage());285 return;286 }287 Assert.fail("Missing " + IllegalArgumentException.class + " because of missing correlation key");288 }289 @Test290 public void testNoCorrelationKeyFound() {291 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();292 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);293 MessageCorrelator correlator = new DefaultMessageCorrelator();294 endpoint.getEndpointConfiguration().setCorrelator(correlator);295 ChannelSyncEndpoint dummyEndpoint = new ChannelSyncEndpoint();296 dummyEndpoint.setName("dummyEndpoint");297 ((ChannelSyncConsumer)dummyEndpoint.createConsumer()).getCorrelationManager().saveCorrelationKey(298 dummyEndpoint.getEndpointConfiguration().getCorrelator().getCorrelationKeyName(dummyEndpoint.createConsumer().getName()),299 "123456789", context);300 Map<String, Object> headers = new HashMap<String, Object>();301 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>", headers);302 try {303 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();304 channelSyncConsumer.send(message, context);305 } catch(CitrusRuntimeException e) {306 Assert.assertTrue(e.getMessage().startsWith("Failed to get correlation key"));307 return;308 }309 Assert.fail("Missing " + IllegalArgumentException.class + " because no reply destination found");310 }311 @Test312 public void testNoReplyDestinationFound() {313 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();314 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);315 endpoint.getEndpointConfiguration().setTimeout(1000L);316 MessageCorrelator correlator = new DefaultMessageCorrelator();317 endpoint.getEndpointConfiguration().setCorrelator(correlator);318 ((ChannelSyncConsumer)endpoint.createConsumer()).getCorrelationManager().saveCorrelationKey(319 endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKeyName(endpoint.createConsumer().getName()),320 "123456789", context);321 Map<String, Object> headers = new HashMap<String, Object>();322 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>", headers);323 try {324 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();325 channelSyncConsumer.send(message, context);326 } catch(IllegalArgumentException e) {327 Assert.assertTrue(e.getMessage().startsWith("Failed to find reply channel"));328 return;329 }330 Assert.fail("Missing " + IllegalArgumentException.class + " because no reply destination found");331 }332 @Test333 public void testSendEmptyMessage() {334 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();335 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);336 try {337 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();338 channelSyncConsumer.send(null, context);339 } catch(IllegalArgumentException e) {340 Assert.assertEquals(e.getMessage(), "Can not send empty message");341 return;342 }343 Assert.fail("Missing " + IllegalArgumentException.class + " because of sending empty message");344 }345 @Test346 public void testSendReplyMessageFail() {347 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();348 endpoint.getEndpointConfiguration().setMessagingTemplate(messagingTemplate);349 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");350 reset(messagingTemplate, replyChannel);351 doThrow(new MessageDeliveryException("Internal error!")).when(messagingTemplate).send(eq(replyChannel), any(org.springframework.messaging.Message.class));352 try {353 ChannelSyncConsumer channelSyncConsumer = (ChannelSyncConsumer) endpoint.createConsumer();354 channelSyncConsumer.saveReplyMessageChannel(new DefaultMessage("").setHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL, replyChannel), context);355 channelSyncConsumer.send(message, context);356 } catch(CitrusRuntimeException e) {357 Assert.assertTrue(e.getMessage().startsWith("Failed to send message to channel: "));358 Assert.assertNotNull(e.getCause());359 Assert.assertEquals(e.getCause().getClass(), MessageDeliveryException.class);360 Assert.assertEquals(e.getCause().getLocalizedMessage(), "Internal error!");361 return;362 }363 Assert.fail("Missing " + CitrusRuntimeException.class + " because of message channel template returned false");364 }365}...
Source:DirectEndpointSyncConsumerTest.java
1/*2 * Copyright 2006-2010 the original author or authors.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package com.consol.citrus.endpoint.direct;17import java.util.HashMap;18import java.util.Map;19import com.consol.citrus.spi.ReferenceResolver;20import com.consol.citrus.context.TestContext;21import com.consol.citrus.exceptions.ActionTimeoutException;22import com.consol.citrus.exceptions.CitrusRuntimeException;23import com.consol.citrus.message.DefaultMessage;24import com.consol.citrus.message.DefaultMessageCorrelator;25import com.consol.citrus.message.Message;26import com.consol.citrus.message.MessageCorrelator;27import com.consol.citrus.message.MessageHeaders;28import com.consol.citrus.message.MessageQueue;29import org.mockito.Mockito;30import org.testng.Assert;31import org.testng.annotations.BeforeMethod;32import org.testng.annotations.Test;33import static org.mockito.Mockito.any;34import static org.mockito.Mockito.doAnswer;35import static org.mockito.Mockito.doThrow;36import static org.mockito.Mockito.reset;37import static org.mockito.Mockito.verify;38import static org.mockito.Mockito.when;39/**40 * @author Christoph Deppisch41 */42public class DirectEndpointSyncConsumerTest {43 private MessageQueue queue = Mockito.mock(MessageQueue.class);44 private MessageQueue replyQueue = Mockito.mock(MessageQueue.class);45 private MessageCorrelator messageCorrelator = Mockito.mock(MessageCorrelator.class);46 private ReferenceResolver resolver = Mockito.mock(ReferenceResolver.class);47 private TestContext context;48 @BeforeMethod49 public void setupMocks() {50 context = new TestContext();51 }52 @Test53 public void testReceiveMessageWithReplyQueue() {54 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();55 endpoint.getEndpointConfiguration().setQueue(queue);56 Map<String, Object> headers = new HashMap<>();57 final Message message = new DefaultMessage("<TestResponse>Hello World!</TestResponse>", headers)58 .setHeader(DirectMessageHeaders.REPLY_QUEUE, replyQueue);59 reset(queue, replyQueue);60 when(queue.receive(5000L)).thenReturn(message);61 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();62 Message receivedMessage = channelSyncConsumer.receive(context);63 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());64 Assert.assertEquals(receivedMessage.getHeader(MessageHeaders.ID), message.getId());65 Assert.assertEquals(receivedMessage.getHeader(DirectMessageHeaders.REPLY_QUEUE), message.getHeader(DirectMessageHeaders.REPLY_QUEUE));66 MessageQueue savedReplyQueue = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),67 endpoint.getEndpointConfiguration().getTimeout());68 Assert.assertNotNull(savedReplyQueue);69 Assert.assertEquals(savedReplyQueue, replyQueue);70 }71 @Test72 public void testReceiveMessageQueueNameResolver() {73 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();74 endpoint.getEndpointConfiguration().setQueueName("testQueue");75 context.setReferenceResolver(resolver);76 Map<String, Object> headers = new HashMap<>();77 final Message message = new DefaultMessage("<TestResponse>Hello World!</TestResponse>", headers)78 .setHeader(DirectMessageHeaders.REPLY_QUEUE, replyQueue);79 reset(queue, replyQueue, resolver);80 when(resolver.resolve("testQueue", MessageQueue.class)).thenReturn(queue);81 when(queue.receive(5000L)).thenReturn(message);82 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();83 Message receivedMessage = channelSyncConsumer.receive(context);84 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());85 Assert.assertEquals(receivedMessage.getHeader(MessageHeaders.ID), message.getId());86 Assert.assertEquals(receivedMessage.getHeader(DirectMessageHeaders.REPLY_QUEUE), message.getHeader(DirectMessageHeaders.REPLY_QUEUE));87 MessageQueue savedReplyQueue = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),88 endpoint.getEndpointConfiguration().getTimeout());89 Assert.assertNotNull(savedReplyQueue);90 Assert.assertEquals(savedReplyQueue, replyQueue);91 }92 @Test93 public void testReceiveMessageWithReplyQueueName() {94 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();95 endpoint.getEndpointConfiguration().setQueue(queue);96 Map<String, Object> headers = new HashMap<>();97 final Message message = new DefaultMessage("<TestResponse>Hello World!</TestResponse>", headers)98 .setHeader(DirectMessageHeaders.REPLY_QUEUE, "replyQueue");99 context.setReferenceResolver(resolver);100 reset(queue, replyQueue, resolver);101 when(queue.receive(5000L)).thenReturn(message);102 when(resolver.resolve("replyQueue", MessageQueue.class)).thenReturn(replyQueue);103 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();104 Message receivedMessage = channelSyncConsumer.receive(context);105 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());106 Assert.assertEquals(receivedMessage.getHeader(MessageHeaders.ID), message.getId());107 Assert.assertEquals(receivedMessage.getHeader(DirectMessageHeaders.REPLY_QUEUE), "replyQueue");108 MessageQueue savedReplyQueue = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),109 endpoint.getEndpointConfiguration().getTimeout());110 Assert.assertNotNull(savedReplyQueue);111 Assert.assertEquals(savedReplyQueue, replyQueue);112 }113 @Test114 public void testReceiveMessageWithCustomTimeout() {115 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();116 endpoint.getEndpointConfiguration().setQueue(queue);117 endpoint.getEndpointConfiguration().setTimeout(10000L);118 Map<String, Object> headers = new HashMap<>();119 final Message message = new DefaultMessage("<TestResponse>Hello World!</TestResponse>", headers)120 .setHeader(DirectMessageHeaders.REPLY_QUEUE, replyQueue);121 reset(queue, replyQueue);122 when(queue.receive(10000L)).thenReturn(message);123 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();124 Message receivedMessage = channelSyncConsumer.receive(context);125 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());126 Assert.assertEquals(receivedMessage.getHeader(MessageHeaders.ID), message.getId());127 MessageQueue savedReplyQueue = channelSyncConsumer.getCorrelationManager().find(endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKey(receivedMessage),128 endpoint.getEndpointConfiguration().getTimeout());129 Assert.assertNotNull(savedReplyQueue);130 Assert.assertEquals(savedReplyQueue, replyQueue);131 }132 @Test133 public void testReceiveMessageWithReplyMessageCorrelator() {134 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();135 endpoint.getEndpointConfiguration().setQueue(queue);136 endpoint.getEndpointConfiguration().setCorrelator(messageCorrelator);137 endpoint.getEndpointConfiguration().setTimeout(500L);138 endpoint.getEndpointConfiguration().setPollingInterval(100);139 Map<String, Object> headers = new HashMap<>();140 final Message message = new DefaultMessage("<TestResponse>Hello World!</TestResponse>", headers)141 .setHeader(DirectMessageHeaders.REPLY_QUEUE, replyQueue);142 reset(queue, replyQueue, messageCorrelator);143 when(queue.receive(500L)).thenReturn(message);144 when(messageCorrelator.getCorrelationKey(any(Message.class))).thenReturn(MessageHeaders.ID + " = '123456789'");145 when(messageCorrelator.getCorrelationKeyName(any(String.class))).thenReturn("correlationKeyName");146 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();147 Message receivedMessage = channelSyncConsumer.receive(context);148 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());149 Assert.assertEquals(receivedMessage.getHeader(MessageHeaders.ID), message.getId());150 Assert.assertNull(channelSyncConsumer.getCorrelationManager().find("", endpoint.getEndpointConfiguration().getTimeout()));151 Assert.assertNull(channelSyncConsumer.getCorrelationManager().find(MessageHeaders.ID + " = 'totally_wrong'",152 endpoint.getEndpointConfiguration().getTimeout()));153 MessageQueue savedReplyQueue = channelSyncConsumer.getCorrelationManager().find(MessageHeaders.ID + " = '123456789'",154 endpoint.getEndpointConfiguration().getTimeout());155 Assert.assertNotNull(savedReplyQueue);156 Assert.assertEquals(savedReplyQueue, replyQueue);157 }158 @Test159 public void testReceiveNoMessage() {160 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();161 endpoint.getEndpointConfiguration().setQueue(queue);162 reset(queue, replyQueue);163 when(queue.receive(5000L)).thenReturn(null);164 try {165 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();166 channelSyncConsumer.receive(context);167 } catch(ActionTimeoutException e) {168 Assert.assertTrue(e.getLocalizedMessage().startsWith("Action timeout after 5000 milliseconds. Failed to receive message on endpoint"));169 return;170 }171 Assert.fail("Missing " + ActionTimeoutException.class + " because no message was received");172 }173 @Test174 public void testReceiveMessageNoReplyQueue() {175 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();176 endpoint.getEndpointConfiguration().setQueue(queue);177 endpoint.getEndpointConfiguration().setTimeout(500L);178 endpoint.getEndpointConfiguration().setPollingInterval(150L);179 Map<String, Object> headers = new HashMap<>();180 final Message message = new DefaultMessage("<TestResponse>Hello World!</TestResponse>", headers);181 reset(queue, replyQueue);182 when(queue.receive(500L)).thenReturn(message);183 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();184 Message receivedMessage = channelSyncConsumer.receive(context);185 Assert.assertEquals(receivedMessage.getPayload(), message.getPayload());186 Assert.assertEquals(receivedMessage.getHeader(MessageHeaders.ID), message.getId());187 MessageQueue savedReplyQueue = channelSyncConsumer.getCorrelationManager().find("", endpoint.getEndpointConfiguration().getTimeout());188 Assert.assertNull(savedReplyQueue);189 }190 @Test191 public void testSendReplyMessage() {192 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();193 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");194 reset(replyQueue);195 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();196 channelSyncConsumer.saveReplyMessageQueue(new DefaultMessage("").setHeader(DirectMessageHeaders.REPLY_QUEUE, replyQueue), context);197 channelSyncConsumer.send(message, context);198 verify(replyQueue).send(any(Message.class));199 }200 @Test201 public void testSendReplyMessageWithReplyMessageCorrelator() {202 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();203 MessageCorrelator correlator = new DefaultMessageCorrelator();204 endpoint.getEndpointConfiguration().setCorrelator(correlator);205 Message request = new DefaultMessage("").setHeader(DirectMessageHeaders.REPLY_QUEUE, replyQueue);206 ((DirectSyncConsumer)endpoint.createConsumer()).getCorrelationManager().saveCorrelationKey(207 endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKeyName(endpoint.createConsumer().getName()),208 request.getId(), context);209 Map<String, Object> headers = new HashMap<>();210 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>", headers);211 reset(replyQueue);212 doAnswer(invocation -> {213 Assert.assertEquals(((DefaultMessage)invocation.getArguments()[0]).getPayload(), message.getPayload());214 return null;215 }).when(replyQueue).send(any(Message.class));216 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();217 channelSyncConsumer.saveReplyMessageQueue(request, context);218 channelSyncConsumer.send(message, context);219 }220 @Test221 public void testSendReplyMessageWithMissingCorrelatorKey() {222 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();223 MessageCorrelator correlator = new DefaultMessageCorrelator();224 endpoint.getEndpointConfiguration().setCorrelator(correlator);225 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");226 try {227 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();228 channelSyncConsumer.send(message, context);229 } catch(CitrusRuntimeException e) {230 Assert.assertTrue(e.getMessage().startsWith("Failed to get correlation key for"), e.getMessage());231 return;232 }233 Assert.fail("Missing " + IllegalArgumentException.class + " because of missing correlation key");234 }235 @Test236 public void testNoCorrelationKeyFound() {237 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();238 MessageCorrelator correlator = new DefaultMessageCorrelator();239 endpoint.getEndpointConfiguration().setCorrelator(correlator);240 DirectSyncEndpoint dummyEndpoint = new DirectSyncEndpoint();241 dummyEndpoint.setName("dummyEndpoint");242 ((DirectSyncConsumer)dummyEndpoint.createConsumer()).getCorrelationManager().saveCorrelationKey(243 dummyEndpoint.getEndpointConfiguration().getCorrelator().getCorrelationKeyName(dummyEndpoint.createConsumer().getName()),244 "123456789", context);245 Map<String, Object> headers = new HashMap<>();246 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>", headers);247 try {248 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();249 channelSyncConsumer.send(message, context);250 } catch(CitrusRuntimeException e) {251 Assert.assertTrue(e.getMessage().startsWith("Failed to get correlation key"));252 return;253 }254 Assert.fail("Missing " + IllegalArgumentException.class + " because no reply destination found");255 }256 @Test257 public void testNoReplyDestinationFound() {258 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();259 endpoint.getEndpointConfiguration().setTimeout(1000L);260 MessageCorrelator correlator = new DefaultMessageCorrelator();261 endpoint.getEndpointConfiguration().setCorrelator(correlator);262 ((DirectSyncConsumer)endpoint.createConsumer()).getCorrelationManager().saveCorrelationKey(263 endpoint.getEndpointConfiguration().getCorrelator().getCorrelationKeyName(endpoint.createConsumer().getName()),264 "123456789", context);265 Map<String, Object> headers = new HashMap<>();266 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>", headers);267 try {268 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();269 channelSyncConsumer.send(message, context);270 } catch(IllegalArgumentException e) {271 Assert.assertTrue(e.getMessage().startsWith("Failed to find reply channel"));272 return;273 }274 Assert.fail("Missing " + IllegalArgumentException.class + " because no reply destination found");275 }276 @Test277 public void testSendEmptyMessage() {278 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();279 try {280 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();281 channelSyncConsumer.send(null, context);282 } catch(IllegalArgumentException e) {283 Assert.assertEquals(e.getMessage(), "Can not send empty message");284 return;285 }286 Assert.fail("Missing " + IllegalArgumentException.class + " because of sending empty message");287 }288 @Test289 public void testSendReplyMessageFail() {290 DirectSyncEndpoint endpoint = new DirectSyncEndpoint();291 final Message message = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");292 reset(replyQueue);293 doThrow(new CitrusRuntimeException("Internal error!")).when(replyQueue).send(any(Message.class));294 try {295 DirectSyncConsumer channelSyncConsumer = (DirectSyncConsumer) endpoint.createConsumer();296 channelSyncConsumer.saveReplyMessageQueue(new DefaultMessage("").setHeader(DirectMessageHeaders.REPLY_QUEUE, replyQueue), context);297 channelSyncConsumer.send(message, context);298 } catch(CitrusRuntimeException e) {299 Assert.assertEquals(e.getClass(), CitrusRuntimeException.class);300 Assert.assertEquals(e.getLocalizedMessage(), "Internal error!");301 return;302 }303 Assert.fail("Missing " + CitrusRuntimeException.class + " because of message channel template returned false");304 }305}...
Source:ChannelSyncConsumer.java
...29/**30 * @author Christoph Deppisch31 * @since 1.432 */33public class ChannelSyncConsumer extends ChannelConsumer implements ReplyProducer {34 /** Logger */35 private static Logger log = LoggerFactory.getLogger(ChannelSyncConsumer.class);36 /** Reply channel store */37 private CorrelationManager<MessageChannel> correlationManager;38 /** Endpoint configuration */39 private final ChannelSyncEndpointConfiguration endpointConfiguration;40 /**41 * Default constructor using emdpoint configuration.42 * @param name43 * @param endpointConfiguration44 */45 public ChannelSyncConsumer(String name, ChannelSyncEndpointConfiguration endpointConfiguration) {46 super(name, endpointConfiguration);47 this.endpointConfiguration = endpointConfiguration;48 this.correlationManager = new PollingCorrelationManager<>(endpointConfiguration, "Reply channel not set up yet");49 }50 @Override51 public Message receive(String selector, TestContext context, long timeout) {52 Message receivedMessage = super.receive(selector, context, timeout);53 saveReplyMessageChannel(receivedMessage, context);54 return receivedMessage;55 }56 @Override57 public void send(Message message, TestContext context) {58 Assert.notNull(message, "Can not send empty message");59 String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());...
ChannelSyncConsumer
Using AI Code Generation
1import com.consol.citrus.annotations.CitrusTest;2import com.consol.citrus.channel.ChannelSyncConsumer;3import com.consol.citrus.dsl.junit.JUnit4CitrusTestDesigner;4import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;5import com.consol.citrus.message.MessageType;6import org.springframework.beans.factory.annotation.Autowired;7import org.springframework.beans.factory.annotation.Qualifier;8import org.springframework.integration.channel.QueueChannel;9import org.springframework.messaging.Message;10import org.springframework.messaging.support.GenericMessage;11import org.springframework.test.context.ContextConfiguration;12import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;13import org.testng.annotations.Test;14import java.util.concurrent.TimeUnit;15@ContextConfiguration(classes = {ChannelSyncConsumerConfig.class})16public class ChannelSyncConsumerTest extends AbstractTestNGSpringContextTests {17 @Qualifier("queueChannel")18 private QueueChannel queueChannel;19 public void testChannelSyncConsumer() {20 run(new TestNGCitrusTestDesigner() {21 public void configure() {22 variable("message", "Hello World!");23 send("queueChannel", "${message}");24 ChannelSyncConsumer syncConsumer = new ChannelSyncConsumer(queueChannel);25 syncConsumer.setMessageType(MessageType.PLAINTEXT);26 syncConsumer.setReceiveTimeout(10000L);27 syncConsumer.setReceiveTimeoutUnit(TimeUnit.MILLISECONDS);28 syncConsumer.setIgnoreExceptions(true);29 syncConsumer.setIgnoreMessageCorrelation(true);30 syncConsumer.setIgnoreMessageControl(true);31 syncConsumer.setIgnoreMessagePayload(true);32 syncConsumer.setIgnoreMessageHeaders(true);33 Message<?> message = syncConsumer.receive();34 System.out.println(message.getPayload());35 }36 });37 }38}39import com.consol.citrus.annotations.CitrusTest;40import com.consol.citrus.channel.ChannelSyncConsumer;41import com.consol.citrus.dsl.junit.JUnit4CitrusTestDesigner;42import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;43import com.consol.citrus.message.MessageType;44import org.springframework.beans.factory.annotation.Autowired;45import org.springframework.beans.factory.annotation.Qualifier;46import org.springframework.integration.channel.QueueChannel;47import org.springframework.messaging.Message;48import org.springframework.messaging.support.GenericMessage;49import org.springframework.test.context.ContextConfiguration
ChannelSyncConsumer
Using AI Code Generation
1import com.consol.citrus.channel.ChannelSyncConsumer;2import com.consol.citrus.channel.ChannelSyncEndpoint;3import org.springframework.context.support.ClassPathXmlApplicationContext;4import org.springframework.integration.Message;5import org.springframework.integration.channel.DirectChannel;6import org.springframework.integration.support.MessageBuilder;7public class 4 {8 public static void main(String[] args) {9 ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");10 DirectChannel inputChannel = context.getBean("inputChannel", DirectChannel.class);11 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();12 endpoint.setChannel(inputChannel);13 ChannelSyncConsumer consumer = new ChannelSyncConsumer(endpoint);14 consumer.start();15 Message<String> message = MessageBuilder.withPayload("Hello World!").build();16 inputChannel.send(message);17 Message<?> receive = consumer.receive(5000);18 System.out.println(receive.getPayload());19 consumer.stop();20 }21}22import com.consol.citrus.channel.ChannelSyncConsumer;23import com.consol.citrus.channel.ChannelSyncEndpoint;24import org.springframework.context.support.ClassPathXmlApplicationContext;25import org.springframework.integration.Message;26import org.springframework.integration.channel.DirectChannel;27import org.springframework.integration.support.MessageBuilder;28public class 5 {29 public static void main(String[] args) {30 ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");31 DirectChannel inputChannel = context.getBean("inputChannel", DirectChannel.class);32 ChannelSyncEndpoint endpoint = new ChannelSyncEndpoint();33 endpoint.setChannel(inputChannel);34 ChannelSyncConsumer consumer = new ChannelSyncConsumer(endpoint);35 consumer.start();
ChannelSyncConsumer
Using AI Code Generation
1package com.consol.citrus.channel;2import org.springframework.context.support.ClassPathXmlApplicationContext;3public class ChannelSyncConsumerTest {4public static void main(String[] args) {5ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:channel-sync-consumer.xml");6context.start();7}8}9package com.consol.citrus.channel;10import org.springframework.context.support.ClassPathXmlApplicationContext;11public class ChannelSyncProducerTest {12public static void main(String[] args) {13ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:channel-sync-producer.xml");14context.start();15}16}17package com.consol.citrus.channel;18import org.springframework.context.support.ClassPathXmlApplicationContext;19public class ChannelSyncProducerTest {20public static void main(String[] args) {21ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:channel-sync-producer.xml");22context.start();23}24}25package com.consol.citrus.channel;26import org.springframework.context.support.ClassPathXmlApplicationContext;27public class ChannelSyncProducerTest {28public static void main(String[] args) {29ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:channel-sync-producer.xml");30context.start();31}32}33package com.consol.citrus.channel;34import org.springframework.context.support.ClassPathXmlApplicationContext;35public class ChannelSyncProducerTest {36public static void main(String[] args) {37ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:channel-sync-producer.xml");38context.start();39}40}41package com.consol.citrus.channel;42import org.springframework.context.support.ClassPathXmlApplicationContext;43public class ChannelSyncProducerTest {44public static void main(String[] args) {
ChannelSyncConsumer
Using AI Code Generation
1{2 public static void main(String[] args) throws Exception3 {4 ChannelSyncConsumer consumer = new ChannelSyncConsumer();5 consumer.setChannelName("testChannel");6 consumer.setApplicationContext(new ClassPathXmlApplicationContext("4.xml"));7 consumer.afterPropertiesSet();8 Message message = consumer.receive(10000L);9 System.out.println(message.getPayload(String.class));10 }11}12{13 public static void main(String[] args) throws Exception14 {15 ChannelSyncProducer producer = new ChannelSyncProducer();16 producer.setChannelName("testChannel");17 producer.setApplicationContext(new ClassPathXmlApplicationContext("5.xml"));18 producer.afterPropertiesSet();19 Message message = new DefaultMessage("Hello World");20 producer.send(message);21 }22}
ChannelSyncConsumer
Using AI Code Generation
1package com.consol.citrus;2import com.consol.citrus.channel.ChannelSyncConsumer;3import org.springframework.integration.Message;4import org.springframework.integration.channel.DirectChannel;5import org.springframework.integration.support.MessageBuilder;6import org.springframework.integration.support.converter.MapMessageConverter;7import java.util.HashMap;8import java.util.Map;9public class ChannelSyncConsumerTest {10 public static void main(String[] args) throws Exception {11 DirectChannel channel = new DirectChannel();12 ChannelSyncConsumer consumer = new ChannelSyncConsumer();13 consumer.setChannel(channel);14 consumer.setMessageConverter(new MapMessageConverter());15 consumer.initialize();16 Map<String, Object> payload = new HashMap<String, Object>();17 payload.put("message", "Hello World!");18 Message<Map<String, Object>> message = MessageBuilder.withPayload(payload).build();19 channel.send(message);20 Message<?> receivedMessage = consumer.receive(10000L);21 System.out.println("Received message: " + receivedMessage);22 }23}24Received message: GenericMessage [payload={message=Hello World!}, headers={id=8b6f3e6c-5b5b-6f8a-3c5f-1b6f9f6c8a6d, timestamp=1429884276795}]
ChannelSyncConsumer
Using AI Code Generation
1package com.consol.citrus;2import org.springframework.context.support.ClassPathXmlApplicationContext;3public class ChannelSyncConsumer {4public static void main(String[] args) {5ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("channel-consumer.xml");6context.start();7}8}9package com.consol.citrus;10import org.springframework.context.support.ClassPathXmlApplicationContext;11public class ChannelSyncProducer {12public static void main(String[] args) {13ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("channel-producer.xml");14context.start();15}16}
ChannelSyncConsumer
Using AI Code Generation
1public class ChannelSyncConsumerTest {2 public void testChannelSyncConsumer() {3 ChannelSyncConsumer channelSyncConsumer = new ChannelSyncConsumer();4 channelSyncConsumer.setChannel("testChannel");5 channelSyncConsumer.setTimeout(1000);6 channelSyncConsumer.setMessageConverter(new DefaultMessageConverter());7 channelSyncConsumer.setMessageSelector("operation = 'add'");8 channelSyncConsumer.setMessageReceiver(new DefaultMessageReceiver());
ChannelSyncConsumer
Using AI Code Generation
1import org.springframework.context.support.ClassPathXmlApplicationContext;2import org.springframework.messaging.Message;3import com.consol.citrus.message.MessageType;4import com.consol.citrus.channel.ChannelSyncConsumer;5public class 4{6 public static void main(String[] args) {7 ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:config/applicationContext.xml");8 ChannelSyncConsumer channelSyncConsumer = context.getBean("channelSyncConsumer", ChannelSyncConsumer.class);9 Message<?> message = channelSyncConsumer.receive("testChannel", 10000L, MessageType.PLAINTEXT);10 System.out.println(message.getPayload());11 }12}
ChannelSyncConsumer
Using AI Code Generation
1package com.consol.citrus.channel;2import java.util.ArrayList;3import java.util.List;4import org.springframework.integration.core.Message;5import org.springframework.integration.core.MessageChannel;6import org.springframework.integration.core.MessageHandler;7import org.springframework.integration.core.PollableChannel;8import org.springframework.integration.core.SubscribableChannel;9import org.springframework.integration.message.GenericMessage;10import org.springframework.integration.support.channel.ChannelResolver;11import org.springframework.integration.support.channel.ChannelResolverUtils;12import org.springframework.util.Assert;13import com.consol.citrus.channel.ChannelSyncConsumer;14import com.consol.citrus.channel.ChannelSyncProducer;15import com.consol.citrus.exceptions.ActionTimeoutException;16import com.consol.citrus.exceptions.CitrusRuntimeException;17import com.consol.citrus.message.MessageReceiver;18import com.consol.citrus.message.MessageSelector;19import com.consol.citrus.message.MessageSelectorBuilder;20import com.consol.citrus.message.MessageSelectorBuilderImpl;21import com.consol.citrus.message.MessageSelectorBuilderImpl.MessageSelectorBuilderImplBuilder;22import com.consol.citrus.message.MessageSelectorBuilderImpl.MessageSelectorBuilderImplBuilderImpl;23import com.consol.citrus.message.MessageSelectorImpl;24import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilder;25import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImpl;26import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilder;27import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilderImpl;28import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilderImplBuilder;29import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilderImplBuilderImpl;30import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilderImplBuilderImplBuilder;31import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilderImplBuilderImplBuilderImpl;32import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilderImplBuilderImplBuilderImplBuilder;33import com.consol.citrus.message.MessageSelectorImpl.MessageSelectorImplBuilderImplBuilderImplBuilderImplBuilderImplBuilder
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!