Example #1
0
        public void NmsCorrelationIdIgnoredIfIncorrectType()
        {
            IMessage message = MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.CORRELATION_ID, 123).Build();
            DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            mapper.FromHeaders(message.Headers, nmsMessage);
            Assert.That(nmsMessage.NMSCorrelationID, Is.Null);
        }
 public void JmsReplyToMappedFromHeader()
 {
     Apache.NMS.IDestination replyTo = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue();
     IMessage message = MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.REPLY_TO, replyTo).Build();
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     mapper.FromHeaders(message.Headers, nmsMessage);
     Assert.That(nmsMessage.NMSReplyTo, Is.Not.Null);
     Assert.That(replyTo, Is.SameAs(nmsMessage.NMSReplyTo));
 }
Example #3
0
        public void NmsReplyToIgnoredIfIncorrectType()
        {
            IMessage message =
                MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.REPLY_TO, "not-a-destination").Build();
            DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            mapper.FromHeaders(message.Headers, nmsMessage);
            Assert.That(nmsMessage.NMSReplyTo, Is.Null);
        }
Example #4
0
        public void JmsReplyToMappedFromHeader()
        {
            Apache.NMS.IDestination replyTo = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue();
            IMessage message = MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.REPLY_TO, replyTo).Build();
            DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            mapper.FromHeaders(message.Headers, nmsMessage);
            Assert.That(nmsMessage.NMSReplyTo, Is.Not.Null);
            Assert.That(replyTo, Is.SameAs(nmsMessage.NMSReplyTo));
        }
Example #5
0
        public void NmsTypeMappedFromHeader()
        {
            string   nmsType = "testing";
            IMessage message = MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.TYPE, nmsType).Build();
            DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            mapper.FromHeaders(message.Headers, nmsMessage);
            Assert.That(nmsMessage.NMSType, Is.Not.Null);
            Assert.That(nmsType, Is.EqualTo(nmsMessage.NMSType));
        }
Example #6
0
        public void NmsCorrelationIdMappedFromHeader()
        {
            string   nmsCorrelationId = "ABC-123";
            IMessage message          =
                MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.CORRELATION_ID, nmsCorrelationId).Build();
            DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            mapper.FromHeaders(message.Headers, nmsMessage);
            Assert.That(nmsMessage.NMSCorrelationID, Is.Not.Null);
            Assert.That(nmsCorrelationId, Is.EqualTo(nmsMessage.NMSCorrelationID));
        }
Example #7
0
        public void UserDefinedPropertyWithUnsupportedType()
        {
            Apache.NMS.IDestination replyTo    = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue();
            Apache.NMS.IMessage     nmsMessage = new StubTextMessage();
            nmsMessage.NMSReplyTo = replyTo;
            DefaultNmsHeaderMapper       mapper  = new DefaultNmsHeaderMapper();
            IDictionary <string, object> headers = mapper.ToHeaders(nmsMessage);
            object attrib = headers[NmsHeaders.REPLY_TO];

            Assert.That(attrib, Is.Not.Null);
            Assert.That(replyTo, Is.SameAs(attrib));
        }
Example #8
0
        public void UserDefinedPropertyMappedToHeader()
        {
            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            nmsMessage.Properties.SetInt("foo", 123);
            DefaultNmsHeaderMapper       mapper  = new DefaultNmsHeaderMapper();
            IDictionary <string, object> headers = mapper.ToHeaders(nmsMessage);
            object attrib = headers["foo"];

            Assert.That(attrib, Is.Not.Null);
            Assert.That(typeof(int), Is.EqualTo(attrib.GetType()));
            Assert.That(123, Is.EqualTo(attrib));
        }
Example #9
0
        public void NmsTypeMappedToHeader()
        {
            string type = "testing";

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            nmsMessage.NMSType = type;
            DefaultNmsHeaderMapper       mapper  = new DefaultNmsHeaderMapper();
            IDictionary <string, object> headers = mapper.ToHeaders(nmsMessage);
            object attrib = headers[NmsHeaders.TYPE];

            Assert.That(attrib, Is.Not.Null);
            Assert.That(type, Is.SameAs(attrib));
        }
Example #10
0
        public void NmsCorrelationIdMappedToHeader()
        {
            string correlationId = "ABC-123";

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            nmsMessage.NMSCorrelationID = correlationId;
            DefaultNmsHeaderMapper       mapper  = new DefaultNmsHeaderMapper();
            IDictionary <string, object> headers = mapper.ToHeaders(nmsMessage);
            object attrib = headers[NmsHeaders.CORRELATION_ID];

            Assert.That(attrib, Is.Not.Null);
            Assert.That(correlationId, Is.SameAs(attrib));
        }
Example #11
0
        public void NmsMessageIdMappedToHeader()
        {
            string          messageId  = "ID:ABC-123";
            StubTextMessage nmsMessage = new StubTextMessage();

            nmsMessage.NMSMessageId = messageId;
            DefaultNmsHeaderMapper       mapper  = new DefaultNmsHeaderMapper();
            IDictionary <string, object> headers = mapper.ToHeaders(nmsMessage);
            object attrib = headers[NmsHeaders.MESSAGE_ID];

            Assert.That(attrib, Is.Not.Null);
            Assert.That(messageId, Is.SameAs(attrib));
        }
Example #12
0
        public void UserDefinedPropertyMappedFromHeader()
        {
            IMessage message = MessageBuilder.WithPayload("test").SetHeader("foo", 123).Build();
            DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();

            Apache.NMS.IMessage nmsMessage = new StubTextMessage();
            mapper.FromHeaders(message.Headers, nmsMessage);
            object value = nmsMessage.Properties["foo"];

            Assert.That(value, Is.Not.Null);
            Assert.That(typeof(int), Is.EqualTo(value.GetType()));
            Assert.That(123, Is.EqualTo(value));
        }
 public void IllegalArgumentExceptionIsNotFatal()
 {
     IMessage message = MessageBuilder.WithPayload("test")
         .SetHeader("foo", 123)
         .SetHeader("bad", 456)
         .SetHeader("bar", 789)
         .Build();
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     StubTextMessage nmsMessage = new StubTextMessage();
     nmsMessage.Properties = new BadPrimitiveMap();
     mapper.FromHeaders(message.Headers, nmsMessage);
     int foo = nmsMessage.Properties.GetInt("foo");
     Assert.That(foo, Is.EqualTo(123));
     int bar = nmsMessage.Properties.GetInt("bar");
     Assert.That(bar, Is.EqualTo(789));
     Assert.That(nmsMessage.Properties.Contains("bad"), Is.False);
 }
Example #14
0
        public void IllegalArgumentExceptionIsNotFatal()
        {
            IMessage message = MessageBuilder.WithPayload("test")
                               .SetHeader("foo", 123)
                               .SetHeader("bad", 456)
                               .SetHeader("bar", 789)
                               .Build();
            DefaultNmsHeaderMapper mapper     = new DefaultNmsHeaderMapper();
            StubTextMessage        nmsMessage = new StubTextMessage();

            nmsMessage.Properties = new BadPrimitiveMap();
            mapper.FromHeaders(message.Headers, nmsMessage);
            int foo = nmsMessage.Properties.GetInt("foo");

            Assert.That(foo, Is.EqualTo(123));
            int bar = nmsMessage.Properties.GetInt("bar");

            Assert.That(bar, Is.EqualTo(789));
            Assert.That(nmsMessage.Properties.Contains("bad"), Is.False);
        }
 public void UserDefinedPropertyWithUnsupportedType()
 {
     Apache.NMS.IDestination replyTo = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue();
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     nmsMessage.NMSReplyTo = replyTo;
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     IDictionary<string, object> headers = mapper.ToHeaders(nmsMessage);
     object attrib = headers[NmsHeaders.REPLY_TO];
     Assert.That(attrib, Is.Not.Null);
     Assert.That(replyTo, Is.SameAs(attrib));
 }
 public void UserDefinedPropertyMappedToHeader()
 {
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     nmsMessage.Properties.SetInt("foo", 123);
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     IDictionary<string, object> headers = mapper.ToHeaders(nmsMessage);
     object attrib = headers["foo"];
     Assert.That(attrib, Is.Not.Null);
     Assert.That(typeof(int), Is.EqualTo(attrib.GetType()));
     Assert.That(123, Is.EqualTo(attrib));
 }
 public void UserDefinedPropertyMappedFromHeader()
 {
     IMessage message = MessageBuilder.WithPayload("test").SetHeader("foo", 123).Build();
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     mapper.FromHeaders(message.Headers, nmsMessage);
     object value = nmsMessage.Properties["foo"];
     Assert.That(value, Is.Not.Null);
     Assert.That(typeof(int), Is.EqualTo(value.GetType()));
     Assert.That(123, Is.EqualTo(value));
 }
 public void NmsTypeMappedToHeader()
 {
     string type = "testing";
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     nmsMessage.NMSType = type;
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     IDictionary<string, object> headers = mapper.ToHeaders(nmsMessage);
     object attrib = headers[NmsHeaders.TYPE];
     Assert.That(attrib, Is.Not.Null);
     Assert.That(type, Is.SameAs(attrib));
 }
 public void NmsTypeMappedFromHeader()
 {
     string nmsType = "testing";
     IMessage message = MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.TYPE, nmsType).Build();
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     mapper.FromHeaders(message.Headers, nmsMessage);
     Assert.That(nmsMessage.NMSType, Is.Not.Null);
     Assert.That(nmsType, Is.EqualTo(nmsMessage.NMSType));
 }
 public void NmsReplyToIgnoredIfIncorrectType()
 {
     IMessage message =
         MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.REPLY_TO, "not-a-destination").Build();
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     mapper.FromHeaders(message.Headers, nmsMessage);
     Assert.That(nmsMessage.NMSReplyTo, Is.Null);
 }
 public void NmsMessageIdMappedToHeader()
 {
     string messageId = "ID:ABC-123";
     StubTextMessage nmsMessage = new StubTextMessage();
     nmsMessage.NMSMessageId = messageId;
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     IDictionary<string, object> headers = mapper.ToHeaders(nmsMessage);
     object attrib = headers[NmsHeaders.MESSAGE_ID];
     Assert.That(attrib, Is.Not.Null);
     Assert.That(messageId, Is.SameAs(attrib));
 }
 public void NmsCorrelationIdMappedToHeader()
 {
     string correlationId = "ABC-123";
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     nmsMessage.NMSCorrelationID = correlationId;
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     IDictionary<string, object> headers = mapper.ToHeaders(nmsMessage);
     object attrib = headers[NmsHeaders.CORRELATION_ID];
     Assert.That(attrib, Is.Not.Null);
     Assert.That(correlationId, Is.SameAs(attrib));
 }
 public void NmsCorrelationIdIgnoredIfIncorrectType()
 {
     IMessage message = MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.CORRELATION_ID, 123).Build();
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     mapper.FromHeaders(message.Headers, nmsMessage);
     Assert.That(nmsMessage.NMSCorrelationID, Is.Null);
 }
 public void NmsCorrelationIdMappedFromHeader()
 {
     string nmsCorrelationId = "ABC-123";
     IMessage message =
         MessageBuilder.WithPayload("test").SetHeader(NmsHeaders.CORRELATION_ID, nmsCorrelationId).Build();
     DefaultNmsHeaderMapper mapper = new DefaultNmsHeaderMapper();
     Apache.NMS.IMessage nmsMessage = new StubTextMessage();
     mapper.FromHeaders(message.Headers, nmsMessage);
     Assert.That(nmsMessage.NMSCorrelationID, Is.Not.Null);
     Assert.That(nmsCorrelationId, Is.EqualTo(nmsMessage.NMSCorrelationID));
 }