public ElasticSearchAppender(IElasticClientFactory clientFactory, LogEventSmartFormatter indexName, LogEventSmartFormatter indexType, IIndexingTimer timer, ITolerateCallsFactory tolerateCallsFactory, ILogBulkSet bulk, ILogEventConverterFactory logEventConverterFactory, ElasticAppenderFilters elasticFilters, IFileAccessor fileAccessor, IExternalEventWriter eventWriter) { _logEventConverterFactory = logEventConverterFactory; _elasticClientFactory = clientFactory; IndexName = indexName; IndexType = indexType; _timer = timer; _timer.Elapsed += (o, e) => DoIndexNow(); _tolerateCallsFactory = tolerateCallsFactory; _bulk = bulk; _fileAccessor = fileAccessor; _eventWriter = eventWriter; FixedFields = FixFlags.Partial; SerializeObjects = true; BulkSize = 2000; BulkIdleTimeout = 5000; DropEventsOverBulkLimit = false; TotalDropEventLimit = null; TimeoutToWaitForTimer = 5000; ElasticSearchTimeout = 10000; IndexAsync = true; Template = null; AllowSelfSignedServerCert = false; Ssl = false; _tolerateCalls = _tolerateCallsFactory.Create(0); Servers = new ServerDataCollection(); ElasticFilters = elasticFilters; AuthenticationMethod = new AuthenticationMethodChooser(); IndexOperationParams = new IndexOperationParamsDictionary(); }
public void Setup() { _elasticClientFactory = Substitute.For <IElasticClientFactory>(); _elasticClient = Substitute.For <IElasticsearchClient>(); _timer = Substitute.For <IIndexingTimer>(); _tolerateCallsFactory = Substitute.For <ITolerateCallsFactory>(); _bulk = Substitute.For <ILogBulkSet>(); _logEventConverterFactory = Substitute.For <ILogEventConverterFactory>(); _logEventConverter = Substitute.For <ILogEventConverter>(); _elasticFilters = new ElasticAppenderFilters(); _fileAccessor = Substitute.For <IFileAccessor>(); _eventWriter = Substitute.For <IExternalEventWriter>(); _elasticClientFactory.CreateClient(null, 0, false, false, null).ReturnsForAnyArgs(_elasticClient); _logEventConverterFactory.Create(FixFlags.All, false).ReturnsForAnyArgs(_logEventConverter); }