private async Task And_a_topic()
        {
            _topicController = new TopicController(
                _serviceProvider.GetService <ITopicDomainService>(),
                _serviceProvider.GetService <ITopicRepository>(),
                _serviceProvider.GetService <ICapabilityRepository>(),
                _serviceProvider.GetService <IKafkaJanitorRestClient>()
                );


            var result = await _topicController.AddTopicToCapability(
                _capability.Id.ToString(),
                new TopicInput { Name = "the topic of the future", Description = "The way topics should be", Partitions = 2, KafkaClusterId = _cluster.Id.ToString(), DryRun = false });

            // Creation of a Topic as it is now needs to be refactored to avoid having to put a random delay/sleep here.
            Thread.Sleep(2000);
            var removeThisAllTopics = await _topicController.GetAll();

            var actionResult = await _topicController
                               .GetAllByCapability(_capability.Id.ToString());

            var okResult = actionResult as OkObjectResult;

            var topicsCollection = (Topic[])okResult.Value
                                   .GetType()
                                   .GetProperty("Items")
                                   .GetValue(okResult.Value);

            var topics = topicsCollection.Any() ? topicsCollection : null;


            Assert.Single(topics);
        }
        private async Task And_a_topic()
        {
            _topicController = new TopicController(
                _serviceProvider.GetService <ITopicDomainService>(),
                _serviceProvider.GetService <ITopicRepository>(),
                _serviceProvider.GetService <ICapabilityRepository>(),
                _serviceProvider.GetService <IKafkaJanitorRestClient>()
                );


            await _topicController.AddTopicToCapability(
                _capability.Id.ToString(),
                new TopicInput { Name = "the topic of the future", Description = "The way topics should be", Partitions = 2 });

            var topics = await DoUntilResultOr5Sec(async() =>
            {
                var actionResult = await _topicController
                                   .GetAllByCapability(_capability.Id.ToString());

                var okResult = actionResult as OkObjectResult;

                var topics = (Topic[])okResult.Value
                             .GetType()
                             .GetProperty("Items")
                             .GetValue(okResult.Value);

                return(topics.Any() ? topics : null);
            });


            Assert.Single(topics);
        }
        private async Task When_a_topic_is_added()
        {
            _topicController = new TopicController(
                _serviceProvider.GetService <ITopicDomainService>(),
                _serviceProvider.GetService <ITopicRepository>(),
                _serviceProvider.GetService <ICapabilityRepository>(),
                _serviceProvider.GetService <IKafkaJanitorRestClient>()
                );


            await _topicController.AddTopicToCapability(
                _capability.Id.ToString(),
                new TopicInput
            {
                Name           = "the topic of the future",
                Description    = "The way topics should be",
                Partitions     = 2,
                Availability   = "public",
                KafkaClusterId = _cluster.Id.ToString()
            }
                );

            // Creation of a Topic as it is now needs to be refactored to avoid having to put a random delay/sleep here.
            Thread.Sleep(2000);
        }
        private async Task When_a_topic_is_added()
        {
            _topicController = new TopicController(
                _serviceProvider.GetService <ITopicDomainService>(),
                _serviceProvider.GetService <ITopicRepository>(),
                _serviceProvider.GetService <ICapabilityRepository>(),
                _serviceProvider.GetService <IKafkaJanitorRestClient>()
                );


            _secondTopicAddResponse = await _topicController.AddTopicToCapability(
                _capability.Id.ToString(),
                new TopicInput { Name = "the topic of the future", Description = "The way topics should be", Partitions = 2, KafkaClusterId = _cluster.Id.ToString(), DryRun = false });
        }
        private async Task When_a_topic_with_too_many_partitions_is_added()
        {
            _topicController = new TopicController(
                _serviceProvider.GetService <ITopicDomainService>(),
                _serviceProvider.GetService <ITopicRepository>(),
                _serviceProvider.GetService <ICapabilityRepository>(),
                _serviceProvider.GetService <IKafkaJanitorRestClient>()
                );


            addTopicToCapabilityActionResult = await _topicController.AddTopicToCapability(
                _capability.Id.ToString(),
                new TopicInput
            {
                Name        = "the topic of the future",
                Description = "The way topics should be",
                Partitions  = Int32.MaxValue
            });
        }
Beispiel #6
0
        private async Task When_a_topic_is_added()
        {
            _topicController = new TopicController(
                _serviceProvider.GetService <ITopicDomainService>(),
                _serviceProvider.GetService <ITopicRepository>(),
                _serviceProvider.GetService <ICapabilityRepository>(),
                _serviceProvider.GetService <IKafkaJanitorRestClient>()
                );


            await _topicController.AddTopicToCapability(
                _capability.Id.ToString(),
                new TopicInput
            {
                Name         = "the topic of the future",
                Description  = "The way topics should be",
                Partitions   = 2,
                Availability = "public"
            }
                );
        }