Exemple #1
0
        public void CanCreateStackAlias()
        {
            _configuration.DeleteIndexes(_client);
            _configuration.ConfigureIndexes(_client);
            var index = _client.GetIndex(descriptor => descriptor.Index(_stackIndex.VersionedName));

            Assert.True(index.IsValid);
            Assert.Equal(1, index.Indices.Count);

            var alias = _client.GetAlias(descriptor => descriptor.Alias(_stackIndex.AliasName));

            Assert.True(alias.IsValid);
            Assert.Equal(1, alias.Indices.Count);
        }
Exemple #2
0
        private async Task CreateStacksAsync()
        {
            _configuration.DeleteIndexes(_client);
            _configuration.ConfigureIndexes(_client);

            var serializer = IoC.GetInstance <JsonSerializer>();

            foreach (var file in Directory.GetFiles(@"..\..\Search\Data\", "stack*.json", SearchOption.AllDirectories))
            {
                if (file.EndsWith("summary.json"))
                {
                    continue;
                }

                using (var stream = new FileStream(file, FileMode.Open)) {
                    using (var streamReader = new StreamReader(stream)) {
                        var stack = serializer.Deserialize(streamReader, typeof(Stack)) as Stack;
                        Assert.NotNull(stack);
                        await _repository.AddAsync(stack);
                    }
                }
            }

            await _client.RefreshAsync();
        }
        private async Task CreateEventsAsync()
        {
            _configuration.DeleteIndexes(_client);
            _configuration.ConfigureIndexes(_client);

            var parserPluginManager = IoC.GetInstance <EventParserPluginManager>();

            foreach (var file in Directory.GetFiles(@"..\..\Search\Data\", "event*.json", SearchOption.AllDirectories))
            {
                if (file.EndsWith("summary.json"))
                {
                    continue;
                }

                var events = parserPluginManager.ParseEvents(File.ReadAllText(file), 2, "exceptionless/2.0.0.0");
                Assert.NotNull(events);
                Assert.True(events.Count > 0);
                foreach (var ev in events)
                {
                    ev.CopyDataToIndex();
                }

                await _repository.AddAsync(events);
            }

            await _client.RefreshAsync();
        }
        private async Task RemoveDataAsync()
        {
            await _cache.RemoveAllAsync();

            _configuration.DeleteIndexes(_client);
            _configuration.ConfigureIndexes(_client);
            await _client.RefreshAsync();
        }