public void FixtureSetup() { _mdc = MetadataCache.TestOnlyNewCache; var mergeOrder = new MergeOrder(null, null, null, new NullMergeSituation()) { EventListener = new ListenerForUnitTests() }; _merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, _mdc); }
private static void CheckPropertyDoesNotExistBeforeUpGrade(MetadataCache mdc, string className, string newPropName) { var classInfo = mdc.GetClassInfo(className); var newProperty = (from propInfo in classInfo.AllProperties where propInfo.PropertyName == newPropName select propInfo).FirstOrDefault(); Assert.IsNull(newProperty, string.Format("{0} {1} should not exist yet.", className, newPropName)); }
private static void CheckPropertyRemovedAfterUpGrade(MetadataCache mdc, string className, string removedPropName) { var classInfo = mdc.GetClassInfo(className); var newProperty = (from propInfo in classInfo.AllProperties where propInfo.PropertyName == removedPropName select propInfo).FirstOrDefault(); Assert.IsNull(newProperty, string.Format("{0} {1} should not exist, after upgrade.", className, removedPropName)); }
private static void CheckPropertyExistsBeforeUpGrade(MetadataCache mdc, string className, string extantPropName) { var classInfo = mdc.GetClassInfo(className); var newProperty = (from propInfo in classInfo.AllProperties where propInfo.PropertyName == extantPropName select propInfo).FirstOrDefault(); Assert.IsNotNull(newProperty, string.Format("{0} {1} should exist, before upgrade.", className, extantPropName)); }
private static void CheckClassDoesNotExistBeforeUpGrade(MetadataCache mdc, string className) { Assert.IsNull(mdc.GetClassInfo(className)); }
private static void CheckSinglePropertyAddedUpgrade(MetadataCache mdc, IChorusFileTypeHandler fileHandler, int ours, string className, string newPropName, DataType dataType) { CheckPropertyDoesNotExistBeforeUpGrade(mdc, className, newPropName); DoMerge(fileHandler, ours); CheckNewPropertyAfterUpgrade(mdc.GetClassInfo(className), newPropName, dataType); }
private static void CheckNoModelChangesUpgrade(MetadataCache mdc, IChorusFileTypeHandler fileHandler, int ours) { var startingClassCount = mdc.AllClasses.Count(); var startingPropertyCount = mdc.AllClasses.Sum(classInfo => classInfo.AllProperties.Count()); DoMerge(fileHandler, ours); Assert.AreEqual(startingClassCount, mdc.AllClasses.Count(), "Different number of classes."); Assert.AreEqual(startingPropertyCount, mdc.AllClasses.Sum(classInfo => classInfo.AllProperties.Count()), "Different number of properties."); }
private static FdoClassInfo CheckClassDoesExistAfterUpGrade(MetadataCache mdc, FdoClassInfo superclass, string newClassname) { var result = mdc.GetClassInfo(newClassname); Assert.IsNotNull(result); Assert.AreSame(superclass, result.Superclass); return result; }
public void TestTearDown() { _mdc = null; }
public void TestSetup() { _mdc = MetadataCache.TestOnlyNewCache; }
public virtual void TestTearDown() { Mdc = null; }
public virtual void TestSetup() { Mdc = MetadataCache.TestOnlyNewCache; }
private static void TokenizeFile(MetadataCache mdc, string srcFwdataPathname, Dictionary<string, SortedDictionary<string, byte[]>> unownedObjects, Dictionary<string, SortedDictionary<string, byte[]>> classData, Dictionary<string, string> guidToClassMapping) { using (var fastSplitter = new FastXmlElementSplitter(srcFwdataPathname)) { bool foundOptionalFirstElement; // NB: The main input file *does* have to deal with the optional first element. foreach (var record in fastSplitter.GetSecondLevelElementBytes(SharedConstants.AdditionalFieldsTag, SharedConstants.RtTag, out foundOptionalFirstElement)) { if (foundOptionalFirstElement) { // Cache custom prop file for later write. var cpElement = DataSortingService.SortCustomPropertiesRecord(SharedConstants.Utf8.GetString(record)); // Add custom property info to MDC, since it may need to be sorted in the data files. foreach (var propElement in cpElement.Elements(SharedConstants.CustomField)) { var className = propElement.Attribute(SharedConstants.Class).Value; var propName = propElement.Attribute(SharedConstants.Name).Value; var typeAttr = propElement.Attribute("type"); var adjustedTypeValue = MetadataCache.AdjustedPropertyType(typeAttr.Value); if (adjustedTypeValue != typeAttr.Value) typeAttr.Value = adjustedTypeValue; var customProp = new FdoPropertyInfo( propName, typeAttr.Value, true); mdc.AddCustomPropInfo( className, customProp); } mdc.ResetCaches(); //optionalFirstElement = Utf8.GetBytes(cpElement.ToString()); foundOptionalFirstElement = false; } else { CacheDataRecord(unownedObjects, classData, guidToClassMapping, record); } } } GC.Collect(2, GCCollectionMode.Forced); }