Ejemplo n.º 1
0
        /// <summary>
        /// The entry point for the DataMigration application
        /// </summary>
        /// <param name="args">The command-line arguments.  Currently, 'nodownload', 
        /// 'postprocessload', and 'singledatasource' are the only 
        /// supported arguments.   The command line processing is very crude, and could stand
        /// to be beefed up.
        /// </param>
        public static void Main(string[] args)
        {
            try {
                var fileInfo = new FileInfo (
                           Path.Combine (Environment.CurrentDirectory, "log4net.config"));

                log4net.Config.XmlConfigurator.Configure (fileInfo);

                ProcessCommandLineArgs (args);

                var plan = DataMigrationPlan.GetPlan ();
                var engine = new MigrationEngine {
                    MigrationPlan = plan,
                    SingleDataSourceCode = singleDataSourceCode,
                    NoDownload = noDownload,
                    PostProcessOnlyLoadNum = postProcessOnlyLoadNum,
                };

                engine.Transform ();

            } catch (Exception ex) {
                log.ErrorFormat ("Error doing UserMigration = {0}, stack = {1}",
                    ex.Message, ex.StackTrace);
            }
        }
 public void MigrationHostTest()
 {
     MigrationEngine mh = new MigrationEngine(null, null, null, new EngineConfigurationBuilderStub());
 }
Ejemplo n.º 3
0
 public void TestEngineCreation()
 {
     MigrationEngine me = services.GetRequiredService <MigrationEngine>();
 }
        private static object RunExecuteAndReturnExitCode(RunOptions opts)
        {
            Telemetry.Current.TrackEvent("ExecuteCommand");
            EngineConfiguration ec;

            if (opts.ConfigFile == string.Empty)
            {
                opts.ConfigFile = "configuration.json";
            }

            if (!File.Exists(opts.ConfigFile))
            {
                Trace.WriteLine("The config file does not exist, nor does the default 'configuration.json'. Use 'init' to create a configuration file first", "[Error]");
                return(1);
            }
            else
            {
                Trace.WriteLine("Loading Config");
                string configurationjson;
                using (var sr = new StreamReader(opts.ConfigFile))
                    configurationjson = sr.ReadToEnd();

                ec = JsonConvert.DeserializeObject <EngineConfiguration>(configurationjson,
                                                                         new FieldMapConfigJsonConverter(),
                                                                         new ProcessorConfigJsonConverter());

#if !DEBUG
                string appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(2);
                if (ec.Version != appVersion)
                {
                    Trace.WriteLine($"The config version {ec.Version} does not match the current app version {appVersion}. There may be compatability issues and we recommend that you generate a new default config and then tranfer the settings accross.", "[Info]");
                    return(1);
                }
#endif
            }
            Trace.WriteLine("Config Loaded, creating engine", "[Info]");

            VssCredentials sourceCredentials = null;
            VssCredentials targetCredentials = null;
            if (!string.IsNullOrWhiteSpace(opts.SourceUserName) && !string.IsNullOrWhiteSpace(opts.SourcePassword))
            {
                sourceCredentials = new VssCredentials(new Microsoft.VisualStudio.Services.Common.WindowsCredential(new NetworkCredential(opts.SourceUserName, opts.SourcePassword, opts.SourceDomain)));
            }

            if (!string.IsNullOrWhiteSpace(opts.TargetUserName) && !string.IsNullOrWhiteSpace(opts.TargetPassword))
            {
                targetCredentials = new VssCredentials(new Microsoft.VisualStudio.Services.Common.WindowsCredential(new NetworkCredential(opts.TargetUserName, opts.TargetPassword, opts.TargetDomain)));
            }

            MigrationEngine me;
            if (sourceCredentials == null && targetCredentials == null)
            {
                me = new MigrationEngine(ec);
            }
            else
            {
                me = new MigrationEngine(ec, sourceCredentials, targetCredentials);
            }
            Console.Title = $"Azure DevOps Migration Tools: {System.IO.Path.GetFileName(opts.ConfigFile)} - {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3)} - {ec.Source.Project} - {ec.Target.Project}";
            Trace.WriteLine("Engine created, running...", "[Info]");
            me.Run();
            Trace.WriteLine("Run complete...", "[Info]");
            return(0);
        }
Ejemplo n.º 5
0
        public static GitRepositoryInfo Create(ExternalLink gitExternalLink, IList <GitRepository> possibleRepos, MigrationEngine migrationEngine, string workItemSourceProjectName)
        {
            var repoType = DetermineFromLink(gitExternalLink.LinkedArtifactUri);

            switch (repoType)
            {
            case RepistoryType.Git:
                return(CreateFromGit(gitExternalLink, possibleRepos));

            case RepistoryType.TFVC:
                return(CreateFromTFVC(gitExternalLink, possibleRepos, migrationEngine.ChangeSetMapping, migrationEngine.Source.Config.Project, workItemSourceProjectName));
            }

            return(null);
        }
Ejemplo n.º 6
0
 public virtual void SetUp()
 {
     DatabaseSession.Instance.CreateConnector("localhost", 5432, "redshifttest", "redshifttest", "1234", ConnectorType.Postgresql);
     MigrationEngine.DropAllTables("public");
 }