Exemple #1
0
        public void WhenCreatingDatabaseFactoryWithGitExtractToCosmosDbCommandLineArgsAndWithProperParametersShouldCreateInstance()
        {
            var commandLineArgs = new GitExtractToCosmosDbCommandLineArgs
            {
                CosmosDbKey    = cosmosDBKey,
                CosmosEndpoint = cosmosEndpoint
            };

            var dbFactory = new DatabaseFactory(commandLineArgs, new JsonSerializerSettings());

            Assert.NotNull(dbFactory);
        }
Exemple #2
0
        public void WhenCreatingDatabaseFactoryWithGitExtractToCosmosDbCommandLineArgsAndNoEndpointShouldThrowArgumentNullException()
        {
            var commandLineArgs = new GitExtractToCosmosDbCommandLineArgs
            {
                CosmosDbKey = cosmosDBKey
            };

            Action action = () =>
            {
                new DatabaseFactory(commandLineArgs, new JsonSerializerSettings());
            };

            var exception = Assert.Throws <ArgumentNullException>(action);

            Assert.Equal("Value cannot be null.\r\nParameter name: CosmosEndpoint", exception.Message);
        }
        public void WhenUsingGitExtractToCosmosDbCommandLineArgsAndExtractingShouldLogChangesetsWithBugs()
        {
            var args = new GitExtractToCosmosDbCommandLineArgs()
            {
                GitLogCommand  = "git log blah",
                BugDatabaseDLL = "some/path/to.dll",
                BugRegexes     = "bug+"
            };

            processor = new GitCodeChurnProcessor(this.commandLineParserMock.Object, this.processWrapperMock.Object,
                                                  this.gitLogParserMock.Object, this.outputProcessorMock.Object, this.bugDatabaseMock.Object, this.logger.Object, args);

            processor.Extract();

            this.logger.Verify(m => m.LogToConsole("Changesets with bugs: 0/0"));
        }
Exemple #4
0
        private static int RunGitToCosmosDbCodeChurnProcessor(GitExtractToCosmosDbCommandLineArgs a)
        {
            var processWrapper         = new ProcessWrapper();
            var commandLineParser      = new CommandLineParser();
            var gitLogParser           = new GitLogParser();
            var logger                 = new ConsoleLoggerWithTimestamp();
            var cosmosConnection       = new CosmosConnection(new DatabaseFactory(a, JsonSerializerSettingsFactory.CreateDefaultSerializerSettingsForCosmosDB()), a.DatabaseId, Properties.Settings.Default.CosmosBulkBatchSize);
            var dataDocumentRepository = new DataDocumentRepository(cosmosConnection, a.CodeChurnCosmosContainer);
            var cosmosOutputProcessor  = new CosmosDbOutputProcessor(logger, dataDocumentRepository, new DataConverter(), a.CosmosProjectName, Properties.Settings.Default.CosmosBulkBatchSize);
            var bugDatabaseFactory     = new BugDatabaseFactory();
            var bugDatabaseDllLoader   = new BugDatabaseDllLoader(logger, bugDatabaseFactory);
            var webRequest             = new WebRequest(new HttpClientWrapperFactory(bugDatabaseFactory));
            var fileSystem             = new FileSystem();
            var jsonParser             = new JsonListParser <WorkItem>(new FileStreamFactory());
            var bugDatabaseProcessor   = new BugDatabaseProcessor(bugDatabaseDllLoader, webRequest, fileSystem, jsonParser, logger, string.Empty);
            //, a.BugDatabaseOutputFile

            var processor = new GitCodeChurnProcessor(commandLineParser, processWrapper, gitLogParser, cosmosOutputProcessor, bugDatabaseProcessor, logger, a);

            processor.QueryBugDatabase();

            return(processor.Extract());
        }
Exemple #5
0
 public GitCodeChurnProcessor(ICommandLineParser commandLineParser, IProcessWrapper processWrapper, IGitLogParser gitLogParser, IOutputProcessor outputProcessor, IBugDatabaseProcessor bugDatabaseProcessor, ILogger logger, GitExtractToCosmosDbCommandLineArgs commandLineArgs) : this(commandLineParser, processWrapper, gitLogParser, outputProcessor, bugDatabaseProcessor, logger, string.Empty, OutputType.CosmosDb, commandLineArgs.BugRegexes, commandLineArgs.BugDatabaseDLL, string.Empty, commandLineArgs.BugDatabaseDllArgs, commandLineArgs.GitLogCommand)
 {
 }