Beispiel #1
0
        /// <summary>
        /// Acquires a block of handles.
        /// </summary>
        /// <param name="blockSize">the number of handles desired
        /// </param>
        /// <returns> the first handle in the acquired block
        /// </returns>

        /* COMMENT ANGEL: Posiblemente este método haya que borrarlo
         * protected virtual long AcquireHandles(long blockSize)
         * {
         *  lock (this)
         *  {
         *      long blockStart = handleCounter;
         *      handleCounter += blockSize;
         *      return blockStart;
         *  }
         * }
         */

        #region IBootstrapObjectModelInteractionListener Members

        public override void OnReceiveHLAGenericInteraction(HLAGenericInteractionMessage msg)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("Received HLAGenericInteraction =  " + msg.ToString());
            }
        }
 public void OnReceiveHLAGenericInteraction(HLAGenericInteractionMessage msg)
 {
     message = msg;
     if (log.IsDebugEnabled)
     {
         log.Debug("Received LastMessage =  " + msg.ToString());
     }
 }
        public void TestHlaGenericInteractionMessage()
        {
            long ticks = System.DateTime.Now.Ticks;
            HLAGenericInteractionMessage msg = new HLAGenericInteractionMessage();

            msg.UserSuppliedTag = System.Text.UnicodeEncoding.Unicode.GetBytes("Sample user data Generic");
            msg.ParameterList   = new HLAparameterHandleValuePair[2];

            msg.ParameterList[0] = new HLAparameterHandleValuePair();
            msg.ParameterList[0].ParameterHandle = 1;
            msg.ParameterList[0].ParameterValue  = BitConverter.GetBytes(Math.PI);

            msg.ParameterList[1] = new HLAparameterHandleValuePair();
            msg.ParameterList[1].ParameterHandle = 2;
            msg.ParameterList[1].ParameterValue  = BitConverter.GetBytes(ticks);

            myListener.LastMessage = null;
            helper.SendInteraction(msg);

            if (!(myListener.LastMessage is HLAGenericInteractionMessage))
            {
                throw new Exception("Error reading HlaGenericInteractionMessage");
            }
            else
            {
                HLAGenericInteractionMessage lastMsg = myListener.LastMessage as HLAGenericInteractionMessage;

                Assert.AreEqual(lastMsg.FederationExecutionHandle, msg.FederationExecutionHandle);
                Assert.AreEqual(lastMsg.InteractionClassHandle, msg.InteractionClassHandle);
                Assert.AreEqual(lastMsg.UserSuppliedTag, msg.UserSuppliedTag);
                Assert.AreEqual(lastMsg.ParameterList.Length, msg.ParameterList.Length);
                Assert.AreEqual(lastMsg.ParameterList[0].ParameterValue, msg.ParameterList[0].ParameterValue);
                Assert.AreEqual(lastMsg.ParameterList[1].ParameterValue, msg.ParameterList[1].ParameterValue);
                Assert.AreEqual(Math.PI, BitConverter.ToDouble(msg.ParameterList[0].ParameterValue, 0));
                Assert.AreEqual(ticks, BitConverter.ToInt64(msg.ParameterList[1].ParameterValue, 0));
            }
        }