public void ShouldWorkWithZeroEncoders()
 {
     var compositeEncoder = new CompositeEncoder();
     var bytes = Encoding.UTF8.GetBytes("lalala");
     var encoderResult = compositeEncoder.Encode(bytes).ToArray();
     Assert.AreEqual(1, encoderResult.Count());
     Assert.AreEqual(bytes, encoderResult.ElementAt(0));
 }
Beispiel #2
0
 protected override ITransport InitializeTransport(IEasyGelfLogger logger)
 {
     var remoteIpAddress = Dns.GetHostAddresses(RemoteAddress)
         .Shuffle()
         .FirstOrDefault() ?? IPAddress.Loopback;
     var encoder = new CompositeEncoder(new GZipEncoder(), new ChunkingEncoder(new MessageBasedIdGenerator(), MessageSize.UdpMessageSize()));
     var configuration = new UdpTransportConfiguration
         {
             Host = new IPEndPoint(remoteIpAddress, RemotePort),
         };
     return new UdpTransport(configuration, encoder, new GelfMessageSerializer());
 }
 public void ShouldWorkWithMultipleEncoders()
 {
     var firstEncoder = mockRepository.StrictMultiMock<ITransportEncoder>();
     firstEncoder.Replay();
     var secondEncoder = mockRepository.StrictMultiMock<ITransportEncoder>();
     secondEncoder.Replay();
     var compositeEncoder = new CompositeEncoder(firstEncoder, secondEncoder);
     var bytes = Encoding.UTF8.GetBytes("lalala");
     firstEncoder.Expect(x => x.Encode(bytes)).Return(new List<byte[]> { bytes });
     secondEncoder.Expect(x => x.Encode(bytes)).Return(new List<byte[]> { bytes });
     var encoderResult = compositeEncoder.Encode(bytes).ToArray();
     Assert.AreEqual(1, encoderResult.Count());
     Assert.AreEqual(bytes, encoderResult.ElementAt(0));
 }
Beispiel #4
0
 protected override ITransport InitializeTransport(IEasyGelfLogger logger)
 {
     var configuration = new AmqpTransportConfiguration
         {
             ConnectionUri = ConnectionUri, 
             Exchange = Exchange, 
             ExchangeType = ExchangeType, 
             Queue = Queue, 
             RoutingKey = RoutingKey,
             Persistent = Persistent,
         };
     var encoder = new CompositeEncoder(new GZipEncoder(), new ChunkingEncoder(new MessageBasedIdGenerator(), MessageSize));
     return new AmqpTransport(configuration, encoder, new GelfMessageSerializer());
 }