private void HelperCreateDefaultConfigFile() { var ecb = new EngineConfigurationBuilder(); EngineConfiguration ec = ecb.BuildDefault(); string json = JsonConvert.SerializeObject(ecb.BuildDefault(), new FieldMapConfigJsonConverter(), new ProcessorConfigJsonConverter()); StreamWriter sw = new StreamWriter("configuration.json"); sw.WriteLine(json); sw.Close(); }
protected static object RunInitAndReturnExitCode(InitOptions opts, TelemetryClient telemetryClient) { _TelemetryClient.TrackEvent("InitCommand"); string configFile = opts.ConfigFile; if (string.IsNullOrEmpty(configFile)) { configFile = "configuration.json"; } Log.Information("ConfigFile: {configFile}", configFile); if (File.Exists(configFile)) { Log.Information("Deleting old configuration.json reference file"); File.Delete(configFile); } if (!File.Exists(configFile)) { Log.Information("Populating config with {Options}", opts.Options.ToString()); IEngineConfigurationBuilder cbuilder = new EngineConfigurationBuilder(); EngineConfiguration config; switch (opts.Options) { case OptionsMode.Full: config = cbuilder.BuildDefault(); break; case OptionsMode.WorkItemTracking: config = cbuilder.BuildWorkItemMigration(); break; default: config = cbuilder.BuildDefault(); break; } string json = JsonConvert.SerializeObject(config, Formatting.Indented, new FieldMapConfigJsonConverter(), new ProcessorConfigJsonConverter()); StreamWriter sw = new StreamWriter(configFile); sw.WriteLine(json); sw.Close(); Log.Information("New configuration.json file has been created"); } return(0); }
public void EngineConfigurationCreateDefault() { IEngineConfigurationBuilder ecb = new EngineConfigurationBuilder(new NullLogger <EngineConfigurationBuilder>()); EngineConfiguration ec = ecb.BuildDefault(); Assert.IsNotNull(ec); Assert.IsNotNull(ec.Source); Assert.AreEqual(ec.Source.ToString(), "FakeMigration"); }
public void EngineConfigurationCreateDefault() { IEngineConfigurationBuilder ecb = new EngineConfigurationBuilder(new NullLogger <EngineConfigurationBuilder>()); EngineConfiguration ec = ecb.BuildDefault(); Assert.IsNotNull(ec); Assert.IsNotNull(ec.Source); Assert.AreEqual(ec.Source.Project, "migrationSource1"); }
public void Setup() { var ecb = new EngineConfigurationBuilder(new NullLogger <EngineConfigurationBuilder>()); var services = new ServiceCollection(); services.AddSingleton <LoggingLevelSwitch>(); // Field Mapps services.AddTransient <FieldBlankMap>(); services.AddTransient <FieldLiteralMap>(); services.AddTransient <FieldMergeMap>(); services.AddTransient <FieldValueMap>(); services.AddTransient <FieldToFieldMap>(); services.AddTransient <FieldtoFieldMultiMap>(); services.AddTransient <FieldToTagFieldMap>(); services.AddTransient <FieldValuetoTagMap>(); services.AddTransient <MultiValueConditionalMap>(); services.AddTransient <RegexFieldMap>(); services.AddTransient <TreeToTagFieldMap>(); //Services services.AddSingleton <IDetectOnlineService, DetectOnlineService>(); services.AddSingleton <IDetectVersionService, DetectVersionService>(); //Containers services.AddSingleton <FieldMapContainer>(); services.AddSingleton <ProcessorContainer>(); services.AddSingleton <TypeDefinitionMapContainer>(); services.AddSingleton <GitRepoMapContainer>(); services.AddSingleton <ChangeSetMappingContainer>(); // services.AddSingleton <IEngineConfigurationBuilder, EngineConfigurationBuilder>(); services.AddSingleton <EngineConfiguration>(ecb.BuildDefault()); services.AddSingleton <ITelemetryLogger, TelemetryLoggerMock>(); services.AddApplicationInsightsTelemetryWorkerService(); services.AddLogging(); //Clients services.AddTransient <IMigrationClient, TfsMigrationClient>(); services.AddTransient <IWorkItemMigrationClient, TfsWorkItemMigrationClient>(); services.AddTransient <IWorkItemQueryBuilder, WorkItemQueryBuilder>(); services.AddSingleton <IMigrationEngine, MigrationEngine>(); services.AddSingleton <ExecuteOptions>((p) => null); _services = services.BuildServiceProvider(); }
public void Setup() { var ecb = new EngineConfigurationBuilder(new NullLogger <EngineConfigurationBuilder>()); var services = new ServiceCollection(); // Core services.AddMigrationToolServicesForUnitTests(); services.AddMigrationToolServicesForClientLegacyCore(); services.AddMigrationToolServices(); services.AddMigrationToolServicesLegacy(); // Clients services.AddMigrationToolServicesForClientAzureDevOpsObjectModel(); services.AddMigrationToolServicesForClientLegacyAzureDevOpsObjectModel(); // services.AddSingleton <IEngineConfigurationBuilder, EngineConfigurationBuilder>(); services.AddSingleton <EngineConfiguration>(ecb.BuildDefault()); services.AddSingleton <IMigrationEngine, MigrationEngine>(); _services = services.BuildServiceProvider(); }
public void TestSeraliseToJson() { var config = ecb.BuildDefault(); ecb.WriteSettings(config, "configuration.json"); }
public void BuildDefaultTest() { var ecb = new EngineConfigurationBuilder(); ecb.BuildDefault(); }