Exemplo n.º 1
0
        protected void OnMessageReceived(object sender, DiscoveryMessageEventArgs e)
        {
            TestMessages TestMessage = new TestMessages();
            string       message     = e.Message;

            message = message.Replace('\n', ' ');
            message = message.Replace('\r', ' ');
            message = message.Replace('\t', ' ');
            message = message.Replace("                ", " ");
            message = message.Replace("        ", " ");
            message = message.Replace("    ", " ");
            message = message.Replace("  ", " ");
            message = message.Replace("> <", "><");
            message = message.Replace(">  <", "><");

            try
            {
                RD.ProbeMatchesType match  = (RD.ProbeMatchesType)TestMessage.Parse_SoapMessage(message, typeof(RD.ProbeMatchesType));
                DeviceDiscovered    device = GetDevice(match, e.Source.Address);
                if (device != null)
                {
                    DeviceDiscoveryEventArgs args = new DeviceDiscoveryEventArgs(device);
                    if (Discovered != null)
                    {
                        Discovered(this, args);
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        public void MessagePassingTest()
        {
            var encoder = new PXMessageEncoder(new Type[] { typeof(TestMessages.TestMessageType1) });
            var message = TestMessages.TestMessageType1Sample1();

            Assert.AreEqual(encoder.DecodeMessage(encoder.EncodeMessage(message)), message);
        }
 private void Consumer2(TestMessages.TestMessage msg)
 {
     lock (_lockObject) {
         Thread.Sleep (_rnd.Next (5));
         _consumer2Received.Add (msg);
     }
 }
Exemplo n.º 4
0
        private void RunButtonClicked(object sender, RoutedEventArgs e)
        {
            ClientTransfer clnt = new ClientTransfer();

            clnt.channel = ClientTransfer.CreateServiceChannel("http://localhost:8001/StreamService");
            HRTimer.HiResTimer hrt = new HRTimer.HiResTimer();
            hrt.Start();
            clnt.uploadFile(testDriver);
            clnt.uploadFile(testCode);
            hrt.Stop();
            Message msg = client.makeMessage("Karthik", client.endPoint, client.endPoint);

            //make a test request
            msg.body = TestMessages.makeTestRequest(testDriver, testCode);
            string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8082);

            msg    = msg.copy();
            msg.to = remoteEndPoint;
            client.comm.sndr.PostMessage(msg);
            btnDriver.IsEnabled = false;
            btnCode.IsEnabled   = false;
            btnRun.IsEnabled    = false;
            btnLog.IsEnabled    = true;
            client.comm.rcvr.CloseChannel(client.endPoint);
            MessageBox.Show("Required files sent to the Repository");
            MessageBox.Show("Test Completed!");
        }
 private void HandleReceived(TestMessages.ADerivedTestMessage msg)
 {
     lock (_receivedMessages) {
         Thread.Sleep(_rnd.Next(5));
         _receivedMessages.Add (msg);
     }
 }
Exemplo n.º 6
0
        protected string BuildProbeMessage()
        {
            RemoteDiscovery.ScopesType Scope;
            TestMessages TestMessage = new TestMessages();

            Scope      = new RemoteDiscovery.ScopesType();
            Scope.Text = new string[] { "" }; //"onvif://www.onvif.org/type/super" , " onvif://www.onvif.org/type/analytics ", " onvif://www.onvif.org/type/video", " onvif://www.onvif.org/name/Bosch", " onvif://www.onvif.org/location/city/Nuernberg", " onvif://www.onvif.org/hardware/Dinion-IP-NWC" };
            return(TestMessage.Build_ProbeRequest("", Scope));
        }
Exemplo n.º 7
0
        public void WithLocalVariables()
        {
            TestMessages.RecordMethodBody(MethodBase.GetCurrentMethod());
            int          x      = 5;
            string       guid   = Guid.NewGuid().ToString();
            const string Format = "hello world {0} this is your number times 3: {1} and a guid: {2}";

            TestMessages.Record(string.Format(CultureInfo.InvariantCulture, Format, x, x * 3, guid));
        }
Exemplo n.º 8
0
        public void FailPassingUnregisteredMessageTest()
        {
            var encoder = new PXMessageEncoder(new Type[] {});
            var message = TestMessages.TestMessageType1Sample1();

            PXUnregisteredMessageReceived received = Assert.Throws <PXUnregisteredMessageReceived>(delegate {
                encoder.DecodeMessage(encoder.EncodeMessage(message));
            });

            Assert.AreEqual(received.Message, $"Unregistered message with hash 155806286 received");
        }
Exemplo n.º 9
0
        public void AgentMessageTest()
        {
            var receiverServerPort = PortProvider.ProviderPort();
            var senderServerPort   = PortProvider.ProviderPort();

            var messageToSend = TestMessages.TestMessageType1Sample1();

            ManualResetEvent       dataReceivedEvent = new ManualResetEvent(false);
            AgentPassingTestServer receiverServer    = new AgentPassingTestServer(delegate(TestMessages.TestMessageType1 message) {
                Assert.AreEqual(messageToSend, message);
                dataReceivedEvent.Set();
            }, "0.0.0.0", receiverServerPort, default, 0);
Exemplo n.º 10
0
        public MessageBrokerShould()
        {
            hostSettings = new ProviderHostSettings(kafkaHost);
            processor    = new Processor();

            var loggerMock = new Mock <IMessageLogger>();

            loggerMock.Setup(x => x.LogMessage(It.IsAny <EventId>(), It.IsAny <IProcessor>(), It.IsAny <ILogMessage>()));
            this.messageLogger = loggerMock.Object;

            testMessages     = TestMessages.GenerateMessages(4);
            receivedMessages = new List <TestMessage>();
            maxMessagesToReadInSingleListener = testMessages.Count;
        }
Exemplo n.º 11
0
 public override void OnExit(MethodBase method)
 {
     TestMessages.Record(string.Format("OnExit: {0}", method.DeclaringType.FullName + "." + method.Name));
 }
Exemplo n.º 12
0
 /// <summary>
 /// A Mock objects That appers to gets a data table from the specifed <see cref="MySqlCommand"/>.
 /// </summary>
 /// <param name="RequestCommand">The request command.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <returns></returns>
 public DataTable GetDataTable(MySqlCommand RequestCommand, string connectionString)
 {
     TestMessages.Add("GetDataTable");
     return(BuildDataTable());
 }
 public override void AbstractMethod()
 {
     TestMessages.Record("InterceptingAbstractMethods.AbstractMethod: Body");
 }
Exemplo n.º 14
0
 public Login_Page(Driver driver, TestMessages testmesssages)  : base(driver, testmesssages)
 {
 }
Exemplo n.º 15
0
 public void NoArguments()
 {
     TestMessages.RecordMethodBody(MethodBase.GetCurrentMethod());
 }
Exemplo n.º 16
0
 public void MixedArguments(int arg1, object arg2, string arg3)
 {
     TestMessages.RecordMethodBody(MethodBase.GetCurrentMethod(), arg1, arg2, arg3);
     Console.WriteLine("WithParameters {0} {1} {2}", arg1, arg2, arg3);
 }
Exemplo n.º 17
0
 public void ReferenceArguments(object arg1, object arg2)
 {
     TestMessages.RecordMethodBody(MethodBase.GetCurrentMethod(), arg1, arg2);
     Console.WriteLine("ObjectParameters", arg1, arg2);
 }
Exemplo n.º 18
0
 public void ValueArguments(int arg1, float arg2)
 {
     TestMessages.RecordMethodBody(MethodBase.GetCurrentMethod(), arg1, arg2);
     Console.WriteLine("ValueParameters {0} {1}", arg1, arg2);
 }
 private void Consumer1(TestMessages.ADerivedTestMessage msg)
 {
     Thread.Sleep(_rnd.Next(5));
     _consumer1Received.Add (msg);
 }
Exemplo n.º 20
0
 public override void OnException(MethodBase method, Exception exception)
 {
     TestMessages.Record(string.Format("OnException: {0} - {1}: {2}", method.DeclaringType.FullName + "." + method.Name, exception.GetType(), exception.Message));
 }
Exemplo n.º 21
0
        public T GetValue <T>(T value)
        {
            TestMessages.Record(string.Format("GenericMethod.GetValue<{0}> - body", typeof(T)));

            return(value);
        }
Exemplo n.º 22
0
 public void AttributeDerivesFromClassThatImplementsInterface()
 {
     TestMessages.Record("AttributeDerivesFromClassThatImplementsInterface: Body");
 }
Exemplo n.º 23
0
 public AddSession_Page(Driver driver, TestMessages testmesssages)  : base(driver, testmesssages)
 {
 }
Exemplo n.º 24
0
 public void AttributeDerivesFromMethodDecoratorAttribute()
 {
     TestMessages.Record("AttributeDerivesFromMethodDecoratorAttribute: Body");
 }
Exemplo n.º 25
0
 public FundaHome_Page(Driver driver, TestMessages testmesssages, string ClassName)
     : base(driver, testmesssages, ClassName)
 {
     OpenQA.Selenium.Support.PageObjects.PageFactory.InitElements(driver.driver, this);
 }
Exemplo n.º 26
0
 public void AttributeImplementsInterface()
 {
     TestMessages.Record("AttributeImplementsInterface: Body");
 }
Exemplo n.º 27
0
 private void generateTestMessages(int number)
 {
     testMessages = TestMessages.GenerateMessages(number);
     maxMessagesToReadInSingleListener = number;
 }
Exemplo n.º 28
0
        public T GetValue(T value)
        {
            TestMessages.Record(string.Format("GenericType<{0}>.GetValue - body", typeof(T)));

            return(value);
        }