예제 #1
0
 /// <exception cref="System.Exception"></exception>
 public virtual void Test()
 {
     UpdateAll();
     ConsistencyChecker.ConsistencyReport consistencyReport = new ConsistencyChecker(FileSession
                                                                                         ()).CheckSlotConsistency();
     Assert.IsTrue(consistencyReport.Consistent(), consistencyReport.ToString());
 }
예제 #2
0
        private void Checkdb()
        {
            ConsistencyReport consistencyReport = new ConsistencyChecker((LocalObjectContainer
                                                                          )Container()).CheckSlotConsistency();

            Assert.IsTrue(consistencyReport.Consistent(), consistencyReport.ToString());
        }
예제 #3
0
        public static void Run(ProgramOptions options)
        {
            foreach (string fileName in options.StatisticsFileNames)
            {
                new Statistics().Run(fileName);
            }

            if (options.InstallPerformanceCounters)
            {
                Db4oPerformanceCounters.ReInstall();
            }

            if (options.CheckDatabase)
            {
                Console.Write("\r\nChecking '{0}' : ", options.Target);
                ConsistencyChecker.Main(new string[] { options.Target });
            }

            if (options.ShowFileUsageStats)
            {
                FileUsageStatsCollector.Main(new string[] { options.Target, "true" });
            }

            if (NoInstrumentationStep(options))
            {
                return;
            }

            using (new CurrentDirectoryAssemblyResolver())
            {
                RunPipeline(options);
            }
        }
예제 #4
0
        private void CheckConsistency()
        {
            ConsistencyReport report = new ConsistencyChecker((LocalObjectContainer)Container
                                                                  ()).CheckSlotConsistency();

            if (!report.Consistent())
            {
                Assert.Fail(report.ToString());
            }
        }
예제 #5
0
        private void Check(IConfiguration config)
        {
            IObjectContainer  db     = base.CreateDatabase(config);
            ConsistencyReport report = new ConsistencyChecker(db).CheckSlotConsistency();

            CloseAndWait(db);
            if (!report.Consistent())
            {
                throw new TestException(report.ToString(), null);
            }
        }
        void AssertOutput(AstNode node)
        {
            RemoveTokens(node);
            StringWriter w = new StringWriter();

            w.NewLine = "\n";
            node.AcceptVisitor(new CSharpOutputVisitor(TokenWriter.CreateWriterThatSetsLocationsInAST(w), FormattingOptionsFactory.CreateSharpDevelop()));
            var doc = new ReadOnlyDocument(w.ToString());

            ConsistencyChecker.CheckMissingTokens(node, "test.cs", doc);
            ConsistencyChecker.CheckPositionConsistency(node, "test.cs", doc);
        }
예제 #7
0
        private void AssertCount(StaticFieldUpdateTestCase.SimpleEnum value, int count)
        {
            ConsistencyChecker.ConsistencyReport consistencyReport = new ConsistencyChecker(FileSession
                                                                                                ()).CheckSlotConsistency();
            if (!consistencyReport.Consistent())
            {
                Sharpen.Runtime.Err.WriteLine(consistencyReport);
                throw new InvalidOperationException("Inconsistency found");
            }
            IQuery query = NewQuery(typeof(StaticFieldUpdateTestCase.Item));

            query.Descend("_value").Constrain(value);
            IObjectSet result = query.Execute();

            Assert.AreEqual(count, result.Count);
            while (result.HasNext())
            {
                Assert.AreEqual(value, ((StaticFieldUpdateTestCase.Item)result.Next())._value);
            }
        }
예제 #8
0
        private void AssertCount(SimpleEnum value, int count)
        {
            var consistencyReport = new ConsistencyChecker(FileSession()).CheckSlotConsistency
                                        ();

            if (!consistencyReport.Consistent())
            {
                Runtime.Err.WriteLine(consistencyReport);
                throw new InvalidOperationException("Inconsistency found");
            }
            var query = NewQuery(typeof(Item));

            query.Descend("_value").Constrain(value);
            var result = query.Execute();

            Assert.AreEqual(count, result.Count);
            while (result.HasNext())
            {
                Assert.AreEqual(value, ((Item)result.Next())._value);
            }
        }
예제 #9
0
        public void MakeValuesConsistentWith(object superiorObject)
        {
            Items.Clear();

            if (superiorObject != null)
            {
                Schema schema;
                Guid   superiorObjectGuid = Guid.Empty;
                if (typeof(PIMComponent).IsAssignableFrom(LookedUpType) && (superiorObject is PSMComponent))
                {
                    schema             = ((PSMComponent)superiorObject).ProjectVersion.PIMSchema;
                    superiorObjectGuid = ((PSMComponent)superiorObject).ID;
                }
                else if (superiorObject is Schema)
                {
                    schema             = (Schema)superiorObject;
                    superiorObjectGuid = ((Schema)superiorObject).ID;
                }
                else if (superiorObject is Component)
                {
                    schema             = ((Component)superiorObject).Schema;
                    superiorObjectGuid = ((Component)superiorObject).ID;
                }
                else
                {
                    throw new NotImplementedException();
                }

                if (LookedUpType == typeof(AttributeType))
                {
                    foreach (AttributeType schemaComponent in schema.ProjectVersion.PIMAttributeTypes)
                    {
                        if (ConsistencyChecker == null || superiorObjectGuid == Guid.Empty ||
                            ConsistencyChecker.VerifyConsistency(superiorObject, schemaComponent))
                        {
                            ListBoxItem listItem = new ListBoxItem();
                            listItem.Content = schemaComponent.ToString();
                            listItem.Tag     = schemaComponent.ID.ToString();
                            Items.Add(listItem);
                        }
                    }
                }
                else
                {
                    foreach (Component schemaComponent in schema.SchemaComponents)
                    {
                        //if (schemaComponent.GetType() == LookedUpType)
                        if (LookedUpType.IsAssignableFrom(schemaComponent.GetType()))
                        {
                            if (ConsistencyChecker == null ||
                                ConsistencyChecker.VerifyConsistency(superiorObject, schemaComponent))
                            {
                                ListBoxItem listItem = new ListBoxItem();
                                listItem.Content = schemaComponent.ToString();
                                listItem.Tag     = schemaComponent.ID.ToString();
                                Items.Add(listItem);
                            }
                        }
                    }
                }
            }

            bool select1 = Items.Count > 0;

            if (AllowNullInput)
            {
                Items.Insert(0, new ListBoxItem {
                    Content = "(null)", Tag = Guid.Empty.ToString()
                });
                SelectedIndex = 0;
            }

            if (Items.Count > 0)
            {
                if (Items.Count > 1 && select1)
                {
                    SelectedIndex = select1 ? 1 : 0;
                }
                else
                {
                    SelectedIndex = 0;
                }

                //OnSelectionChanged(null);
            }

            if (SuggestedValue != null && SuggestedValue is ExolutioObject)
            {
                this.SelectedItem = this.Items.FirstOrDefault(i => ((ListBoxItem)i).Tag.ToString() == ((ExolutioObject)SuggestedValue).ID.ToString());
            }
            //OnSelectionChanged(null);
        }