示例#1
0
 private async Task<Service> CreateSplunkServiceFor(SplunkWriterConfig config)
 {
     var service = new Service(new Uri(config.RemoteUrl));
     await service.LogOnAsync(config.Login, config.Password);
     // ensure that the index is alive and well
     var index = await service.Indexes.GetOrNullAsync(config.IndexName)
                 ?? await service.Indexes.CreateAsync(config.IndexName);
     await index.EnableAsync();
     return service;
 }
        public void Construct_ShouldCopyParametersToProperties()
        {
            //---------------Set up test pack-------------------
            var index = RandomValueGen.GetRandomString();
            var appender = RandomValueGen.GetRandomString();
            var url = RandomValueGen.GetRandomHttpUrl();
            var login = RandomValueGen.GetRandomString();
            var password = RandomValueGen.GetRandomString();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var sut = new SplunkWriterConfig(appender, index, url, login, password);

            //---------------Test Result -----------------------
            Assert.AreEqual(appender, sut.AppenderName);
            Assert.AreEqual(index, sut.IndexName);
            Assert.AreEqual(url, sut.RemoteUrl);
            Assert.AreEqual(login, sut.Login);
            Assert.AreEqual(password, sut.Password);
        }
示例#3
0
 public SplunkWriter(SplunkWriterConfig[] configurations)
 {
     _instanceConfigurations = configurations;
 }