예제 #1
0
파일: Broker.cs 프로젝트: BernardoMG/SESDAD
 public void dummyGlobalUpdate()
 {
     lock (this)
     {
         dummyStruct dummy          = new dummyStruct();
         string      senderInPacket = "";
         if (requestDummy.Count >= (dummyOrder + 1))
         {
             dummy = requestDummy[dummyOrder];
             dummyOrder++;
             senderInPacket = dummy.publish.urlBrokerSender;
             if (!dummy.urlRoutingTable.Contains(fatherBrokerUrl) && fatherBrokerUrl != "none" && !fatherBrokerUrl.Equals(dummy.publish.urlBrokerSender))
             {
                 BrokerInterface brokerFather = (BrokerInterface)Activator.GetObject(typeof(BrokerInterface), fatherBrokerUrl);
                 dummy.publish.urlBrokerSender = brokerData.url;
                 brokerFather.queuEvent(dummy.publish);
                 dummy.publish.urlBrokerSender = senderInPacket;
             }
             if (childs != null)
             {
                 foreach (string child in childs)
                 {
                     if (!dummy.urlRoutingTable.Contains(child) && !child.Equals(dummy.publish.urlBrokerSender))
                     {
                         BrokerInterface brokerChild = (BrokerInterface)Activator.GetObject(typeof(BrokerInterface), child);
                         dummy.publish.urlBrokerSender = brokerData.url;
                         brokerChild.queuEvent(dummy.publish);
                         dummy.publish.urlBrokerSender = senderInPacket;
                     }
                 }
             }
         }
     }
 }
        public void ByteBuffer_Put_Array_IncorrectType_Throws()
        {
            // Create the Byte Buffer
            var uut = new ByteBuffer(1024);

            // Create an array of dummy structures that shouldn't be
            // able to be put into the buffer
            var data = new dummyStruct[10];

            Assert.Throws <ArgumentException>(() => uut.Put(1024, data));
        }
예제 #3
0
파일: Broker.cs 프로젝트: BernardoMG/SESDAD
 public void filteringBase()
 {
     lock (this)
     {
         publisherParameters publish;
         List <string>       urls   = new List <string>();
         string      senderInPacket = "";
         dummyStruct dummy          = new dummyStruct();
         bool        send           = false;
         if (commandList.Count >= (rountingEventManager + 1))
         {
             publish = commandList[rountingEventManager];
             rountingEventManager++;
             urls                  = hasRoutingEntry(publish.topicName);
             senderInPacket        = publish.urlBrokerSender;
             dummy.urlRoutingTable = urls;
             dummy.publish         = publish;
             requestDummy.Add(dummy);
             if (!SingleMachine)
             {
                 remoteSlave.msgToSlave("New Event by: " + publish.processName + " on: " + publish.topicName);
             }
             if (urls.Count != 0)
             {
                 foreach (string url in urls)
                 {
                     if (!url.Equals(publish.urlBrokerSender))
                     {
                         send = true;
                         BrokerInterface broker = (BrokerInterface)Activator.GetObject(typeof(BrokerInterface), url);
                         publish.urlBrokerSender = brokerData.url;
                         broker.queuEvent(publish);
                         publish.urlBrokerSender = senderInPacket;
                     }
                 }
             }
             if (send)
             {
                 Console.WriteLine("BroEvent: " + brokerData.name + ", " + publish.processName + ", " + publish.topicName + ", " + publish.sequenceNumber);
             }
             ThreadStart b   = new ThreadStart(this.dummyGlobalUpdate);
             Thread      t_b = new Thread(b);
             t_b.Start();
         }
     }
 }
예제 #4
0
        public unsafe void ByteBuffer_Put_Array_IncorrectType_Throws()
        {
            // Create the Byte Buffer
            var uut = new ByteBuffer(1024);

            // Create an array of dummy structures that shouldn't be
            // able to be put into the buffer
            var data = new dummyStruct[10];

            Assert.Throws <ArgumentException>(() => uut.Put(1024, data));

            var dataArraySegment = new ArraySegment <dummyStruct>(data);

            Assert.Throws <ArgumentException>(() => uut.Put(1024, dataArraySegment));

            fixed(dummyStruct *floatPtr = data)
            {
                var dataPtr       = (IntPtr)floatPtr;
                var dataPtrLength = data.Length * sizeof(dummyStruct);

                Assert.Throws <ArgumentException>(() => uut.Put <dummyStruct>(1024, dataPtr, dataPtrLength));
            }
        }