Exemplo n.º 1
0
        public IsolationReview(ProcessTask processTask)
        {
            if (processTask == null)
            {
                throw new ArgumentNullException(nameof(processTask));
            }

            if (!processTask.IsPluginType() || processTask.ProcessTaskType != ProcessTaskType.MutilateDataTable ||
                processTask.Path != typeof(PrimaryKeyCollisionIsolationMutilation).FullName)
            {
                Error = "ProcessTask is not an isolation mutilation";
                return;
            }

            foreach (IArgument a in processTask.GetAllArguments())
            {
                try
                {
                    if (a.Name.Equals(nameof(PrimaryKeyCollisionIsolationMutilation.TablesToIsolate)))
                    {
                        TablesToIsolate = (TableInfo[])a.GetValueAsSystemType();
                    }
                    if (a.Name.Equals(nameof(PrimaryKeyCollisionIsolationMutilation.IsolationDatabase)))
                    {
                        IsolationDatabase = (ExternalDatabaseServer)a.GetValueAsSystemType();
                    }
                }
                catch (Exception e)
                {
                    Error = $"Bad Argument {a} : {e.Message}";
                    return;
                }
            }

            if (TablesToIsolate == null || TablesToIsolate.Length == 0)
            {
                Error = "No tables configured on Isolation task";
                return;
            }

            if (IsolationDatabase != null)
            {
                return;
            }
            Error = "No isolation database configured on Isolation task";
        }
Exemplo n.º 2
0
        public void GatherAndShare_LoadMetadata_WithRealProcessTask()
        {
            //create an object
            LoadMetadata lmd1 = WhenIHaveA <LoadMetadata>();

            SetupMEF();

            var pt1 = new ProcessTask(Repository, lmd1, LoadStage.Mounting);

            pt1.ProcessTaskType = ProcessTaskType.Attacher;
            pt1.LoadStage       = LoadStage.Mounting;
            pt1.Path            = typeof(AnySeparatorFileAttacher).FullName;
            pt1.SaveToDatabase();

            pt1.CreateArgumentsForClassIfNotExists(typeof(AnySeparatorFileAttacher));
            var pta = pt1.ProcessTaskArguments.Single(pt => pt.Name == "Separator");

            pta.SetValue(",");
            pta.SaveToDatabase();


            var lmd2 = ShareToNewRepository(lmd1);

            //different repos so not identical
            Assert.IsFalse(ReferenceEquals(lmd1, lmd2));
            AssertAreEqual(lmd1, lmd2);

            var pt2 = lmd2.ProcessTasks.Single();

            Assert.IsFalse(ReferenceEquals(pt1, pt2));
            AssertAreEqual(pt1, pt2);

            AssertAreEqual(pt1.GetAllArguments(), pt2.GetAllArguments());

            RuntimeTaskFactory f = new RuntimeTaskFactory(Repository);

            var stg = Mock.Of <IStageArgs>(x => x.LoadStage == LoadStage.Mounting);

            f.Create(pt1, stg);
        }