public void GetDiffTest() { SchemaComparableList <TestSchemaComparable> scList1 = new SchemaComparableList <TestSchemaComparable>(testList1); SchemaComparableList <TestSchemaComparable> scList2 = new SchemaComparableList <TestSchemaComparable>(testList2); TupleList <TestSchemaComparable, TestSchemaComparable> diff = scList1.GetDiff(scList2); Assert.AreEqual("C-CCC", diff[0].Item1.full); Assert.AreEqual("C-CC", diff[0].Item2.full); Assert.AreEqual("D-DDD", diff[1].Item1.full); Assert.AreEqual("D-DD", diff[1].Item2.full); Assert.IsNull(diff[2].Item1); Assert.AreEqual("E-EEE", diff[2].Item2.full); Assert.AreEqual("F-FFF", diff[3].Item1.full); Assert.IsNull(diff[3].Item2); Assert.AreEqual("G-GGG", diff[4].Item1.full); Assert.IsNull(diff[4].Item2); }
public SchemaMetadataDiff( SchemaComparableList <SchemaEntry> baseAtEntries, SchemaComparableList <SchemaEntry> baseOcEntries, SchemaComparableList <SchemaEntry> otherAtEntries, SchemaComparableList <SchemaEntry> otherOcEntries) { attributeTypeDiff = baseAtEntries.GetDiff(otherAtEntries); objectClassDiff = baseOcEntries.GetDiff(otherOcEntries); }
public SchemaDefinitionDiff(SubSchemaSubEntry baseSubSchema, SubSchemaSubEntry otherSubSchema) { SchemaComparableList <AttributeType> baseAtList = baseSubSchema.GetAttributeTypeList(); SchemaComparableList <AttributeType> otherAtList = otherSubSchema.GetAttributeTypeList(); attributeTypeDiff = baseAtList.GetDiff(otherAtList); SchemaComparableList <ObjectClass> baseOcList = baseSubSchema.GetObjectClassList(); SchemaComparableList <ObjectClass> otherOcList = otherSubSchema.GetObjectClassList(); objectClassDiff = baseOcList.GetDiff(otherOcList); }
private static void listSchemaMetadataDiffBreakdown(SchemaEntry e1, SchemaEntry e2) { SchemaComparableList <AttributeMetadata> mdList1 = null; SchemaComparableList <AttributeMetadata> mdList2 = null; if (e1 != null && e2 != null) { mdList1 = e1.GetMetadataList(); mdList2 = e2.GetMetadataList(); TupleList <AttributeMetadata, AttributeMetadata> diff = mdList1.GetDiff(mdList2); Console.WriteLine("\tBASE: {0}", e1.defName); foreach (Tuple <AttributeMetadata, AttributeMetadata> t in diff) { Console.WriteLine("\t\t{0}", t.Item1); } Console.WriteLine("\tOTHE: {0}", e2.defName); foreach (Tuple <AttributeMetadata, AttributeMetadata> t in diff) { Console.WriteLine("\t\t{0}", t.Item2); } } else if (e1 != null) { mdList1 = e1.GetMetadataList(); Console.WriteLine("\tBASE: {0}", e1.defName); foreach (AttributeMetadata md in mdList1) { Console.WriteLine("\t\t{0}", md); } Console.WriteLine("\tOTHE:"); } else { mdList2 = e2.GetMetadataList(); Console.WriteLine("\tBASE:"); Console.WriteLine("\tOTHE: {0}", e2.defName); foreach (AttributeMetadata md in mdList2) { Console.WriteLine("\t\t{0}", md); } } Console.WriteLine("\t-----"); }
public void GetDiffNullArgumentTest() { SchemaComparableList <TestSchemaComparable> scList1 = new SchemaComparableList <TestSchemaComparable>(testList1); try { scList1.GetDiff(null); Assert.Fail(); } catch (ArgumentNullException) { // pass } catch (Exception) { Assert.Fail(); } }
private void listSchemaMetadataDiffBreakdown(SchemaEntry e1, SchemaEntry e2) { SchemaComparableList <AttributeMetadata> mdList1 = null; SchemaComparableList <AttributeMetadata> mdList2 = null; if (e1 != null && e2 != null) { mdList1 = e1.GetMetadataList(); mdList2 = e2.GetMetadataList(); VmDirInterop.Schema.Utils.TupleList <AttributeMetadata, AttributeMetadata> diff = mdList1.GetDiff(mdList2); foreach (Tuple <AttributeMetadata, AttributeMetadata> t in diff) { //baseMetaData string baseData = (t.Item1 != null) ? e1.defName + " : " + t.Item1.ToString() : VMDirSchemaConstants.MISING_METADATA; string currentData = (t.Item2 != null) ? e1.defName + " : " + t.Item2.ToString() : VMDirSchemaConstants.MISING_METADATA; MetaDataDiff.Add(new KeyValuePair <string, string>(baseData, currentData)); } } else if (e1 != null) { mdList1 = e1.GetMetadataList(); foreach (AttributeMetadata md in mdList1) { string baseData = e1.defName + " : " + md; string currentData = VMDirSchemaConstants.MISING_METADATA; MetaDataDiff.Add(new KeyValuePair <string, string>(baseData, currentData)); } } else { mdList2 = e2.GetMetadataList(); foreach (AttributeMetadata md in mdList2) { string currentData = e1.defName + " : " + md; string baseData = VMDirSchemaConstants.MISING_METADATA; MetaDataDiff.Add(new KeyValuePair <string, string>(baseData, currentData)); } } }