Пример #1
0
        public void TestEndtoEnd()
        {
            XmlConfigurator.Configure();

            var server = new MockThriftServer();

            logger.Info("Test Message");
            Thread.Sleep(100);
            server.Close();

            Assert.AreEqual(1, server.ReceivedEvents.Count, "The server should receive 1 event.");
            ThriftFlumeEvent receivedEvent = server.ReceivedEvents[0];
            string actualMessage = StringHelpers.GetString(receivedEvent.Body);
            Assert.AreEqual(Priority.INFO, receivedEvent.Priority);
            Assert.IsTrue(actualMessage.Contains("Test Message"));
        }
Пример #2
0
        public void TestEndtoEnd()
        {
            XmlConfigurator.Configure();

            var server = new MockThriftServer();

            logger.Info("Test Message");
            Thread.Sleep(100);
            server.Close();

            Assert.AreEqual(1, server.ReceivedEvents.Count, "The server should receive 1 event.");
            ThriftFlumeEvent receivedEvent = server.ReceivedEvents[0];
            string           actualMessage = StringHelpers.GetString(receivedEvent.Body);

            Assert.AreEqual(Priority.INFO, receivedEvent.Priority);
            Assert.IsTrue(actualMessage.Contains("Test Message"));
        }
Пример #3
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();

            var server = new MockThriftServer();

            logger.Info("Test Message");
            Thread.Sleep(100);
            server.Close();

            ThriftFlumeEvent receivedEvent = server.ReceivedEvents[0];
            string actualMessage = StringHelpers.GetString(receivedEvent.Body);

            if (1 != server.ReceivedEvents.Count)
                throw new InvalidProgramException("The server should receive 1 event.");

            if (Priority.INFO != receivedEvent.Priority)
                throw new InvalidProgramException();

            if (!actualMessage.Contains("Test Message"))
                throw new InvalidProgramException();
        }
Пример #4
0
        private static void Main(string[] args)
        {
            // Can't run these until there is a new version of the NLog client.

            MockThriftServer server = null;

            logger.Info("Test Message");
            logger.Info("Test Message");
            Thread.Sleep(100);

            return;

            // Release the connection to the server
            LogManager.Configuration.AllTargets[0].Dispose();

            // Cleanup the server
            server.Close();

            if (1 != server.ReceivedEvents.Count)
            {
                throw new InvalidProgramException("The server should receive 1 event.");
            }

            ThriftFlumeEvent receivedEvent = server.ReceivedEvents[0];
            string           actualMessage = StringHelpers.GetString(receivedEvent.Body);

            if (Priority.INFO != receivedEvent.Priority)
            {
                throw new InvalidProgramException();
            }

            if (!actualMessage.Contains("Test Message"))
            {
                throw new InvalidProgramException();
            }
        }