public void GatewayWithConnectionFactoryAndDestinationName() { XmlApplicationContext ctx = (XmlApplicationContext) NmsTestUtils.GetContext(@"Nms\Config\NmsGatewayWithConnectionFactoryAndDestinationName.xml"); IPollableChannel channel = (IPollableChannel)ctx.GetObject("requestChannel"); NmsMessageDrivenEndpoint gateway = (NmsMessageDrivenEndpoint)ctx.GetObject("nmsGateway"); Assert.That(gateway.GetType(), Is.EqualTo(typeof(NmsMessageDrivenEndpoint))); ctx.Start(); ThreadPerTaskExecutor executor = new ThreadPerTaskExecutor(); executor.Execute(delegate { SimpleMessageListenerContainer listenerContainer = (SimpleMessageListenerContainer) ctx.GetObject("Spring.Messaging.Nms.Listener.SimpleMessageListenerContainer#0"); ISessionAwareMessageListener messageListener = (ISessionAwareMessageListener)listenerContainer.MessageListener; messageListener.OnMessage(new StubTextMessage("message-driven-test"), new StubSession("message-driven-test")); }); IMessage message = channel.Receive(TimeSpan.FromMilliseconds(3000)); Assert.That(message, Is.Not.Null); Assert.That(message.Payload, Is.EqualTo("message-driven-test")); ctx.Stop(); }
public void GatewayWithConcurrentConsumers() { XmlApplicationContext ctx = (XmlApplicationContext)NmsTestUtils.GetContext(@"Nms\Config\NmsGatewayWithContainerSettings.xml"); NmsMessageDrivenEndpoint gateway = (NmsMessageDrivenEndpoint)ctx.GetObject("gatewayWithConcurrentConsumers"); gateway.Start(); object cc = TestUtils.GetFieldValue(TestUtils.GetFieldValue(gateway, "listenerContainer"), "concurrentConsumers"); Assert.That(cc, Is.EqualTo(3)); gateway.Stop(); }
public void GatewayWithContainerReference() { XmlApplicationContext ctx = (XmlApplicationContext)NmsTestUtils.GetContext(@"Nms\Config\InboundGatewayWithContainerReference.xml"); NmsMessageDrivenEndpoint gateway = (NmsMessageDrivenEndpoint)ctx.GetObject("gatewayWithContainerReference"); gateway.Start(); object cc = TestUtils.GetFieldValue(TestUtils.GetFieldValue(gateway, "listenerContainer"), "concurrentConsumers"); Assert.That(cc, Is.EqualTo(1)); //default value of concurrent consumers. gateway.Stop(); }
public void GatewayWithExtractReplyPayloadFalse() { XmlApplicationContext ctx = (XmlApplicationContext) NmsTestUtils.GetContext(@"Nms\Config\NmsGatewaysWithExtractPayloadAttributes.xml"); NmsMessageDrivenEndpoint gateway = (NmsMessageDrivenEndpoint)ctx.GetObject("extractReplyPayloadFalse"); object handler = TestUtils.GetFieldValue(TestUtils.GetFieldValue(gateway, "listener"), "extractReplyPayload"); Assert.That(handler, Is.EqualTo(false), "The inbound gateway extract-reply-payload is not configured to the correct value."); }