Example #1
0
        public void TestLocateReplySerialisation()
        {
            uint requestId = 5;

            byte[]               objectKey = new byte[] { 116, 101, 115, 116, 111, 98, 106, 101, 99, 116 }; // testobject
            string               targetUri = "testobject";
            GiopVersion          version   = new GiopVersion(1, 2);
            LocateRequestMessage locReq    = new LocateRequestMessage(requestId, objectKey, targetUri);
            // create a connection context
            GiopConnectionDesc conDesc = new GiopConnectionDesc(null, null);

            // create the reply
            LocateStatus       replyStatus = LocateStatus.OBJECT_HERE;
            LocateReplyMessage locReply    = new LocateReplyMessage(replyStatus);

            MemoryStream targetStream = new MemoryStream();

            m_handler.SerialiseOutgoingLocateReplyMessage(locReply, locReq, version, targetStream, conDesc);

            // check to serialised stream
            targetStream.Seek(0, SeekOrigin.Begin);

            CdrInputStreamImpl cdrIn = new CdrInputStreamImpl(targetStream);

            cdrIn.ConfigStream(0, version);

            // first is Giop-magic
            byte data;

            AssertBytesFollowing(m_giopMagic, cdrIn);
            // Giop version
            data = (byte)cdrIn.ReadOctet();
            Assert.AreEqual(1, data);
            data = (byte)cdrIn.ReadOctet();
            Assert.AreEqual(2, data);
            // flags: big-endian, no fragements
            data = (byte)cdrIn.ReadOctet();
            Assert.AreEqual(0, data);
            // Giop Msg type: locate reply
            data = (byte)cdrIn.ReadOctet();
            Assert.AreEqual((byte)GiopMsgTypes.LocateReply, data);
            // Giop Msg length
            uint msgLength = cdrIn.ReadULong();

            cdrIn.SetMaxLength(msgLength);
            // req-id
            Assert.AreEqual(requestId, cdrIn.ReadULong());
            // the location status
            Assert.AreEqual((uint)replyStatus, cdrIn.ReadULong());
        }
Example #2
0
 internal LocateReplyMessage(LocateStatus status)
 {
     m_properties[STATUS_KEY] = status;
 }
Example #3
0
 internal LocateReplyMessage(LocateStatus status) {
     m_properties[STATUS_KEY] = status;            
 }