Skip to content

Commit 9a193e4

Browse files
author
Roelant Vos
committed
Update TeamValidation.cs
1 parent d840686 commit 9a193e4

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

Team_Library/TeamValidation.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,8 @@ public static List<string> ValidateLogicalGroup(List<DataRow> dataRows, DataTabl
548548
List<string> resultList = new List<string>();
549549

550550
#region Retrieving the Integration Layer tables
551-
552551
// Informing the user.
553-
resultList.Add("\r\n--> Commencing the validation to check if the functional dependencies (logical group / unit of work) are present.\r\n");
552+
resultList.Add("\r\n--> Commencing the validation to check if the functional dependencies (logical group / unit of work) are present.\r\n\r\n");
554553

555554
// Creating a list of tables which are dependent on other tables being present
556555
var objectList = new List<Tuple<string, string, string, string>>(); // Source Name, Target Name, Business Key, FilterCriterion
@@ -620,21 +619,19 @@ public static List<string> ValidateLogicalGroup(List<DataRow> dataRows, DataTabl
620619
}
621620
}
622621
}
623-
624622
#endregion
625623

626624
// Return the results back to the user
627625
if (resultDictionary.Count > 0)
628626
{
629627
foreach (var sourceObjectResult in resultDictionary)
630628
{
631-
resultList.Add(" " + sourceObjectResult.Key + " is tested with this outcome: " + sourceObjectResult.Value + "." +
632-
"\r\n This means there is a Link or Satellite without it's supporting Hub(s) defined." +
633-
"\r\n If a source loads a Link or Satellite, this source should also load a Hub that relates to the Link or Satellite.\r\n");
629+
resultList.Add(" " + sourceObjectResult.Key + " has validation issues.\r\n");
634630
metadataValidations.ValidationIssues++;
635631
}
636632

637-
resultList.Add("\r\n");
633+
resultList.Add("\r\n This means there is a Link or Satellite without it's supporting Hub(s) defined." +
634+
"\r\n If a source loads a Link or Satellite, this source should also load a Hub that relates to the Link or Satellite.\r\n");
638635
}
639636
else
640637
{
@@ -688,7 +685,8 @@ internal static Dictionary<string, bool> ValidateLogicalGroup(Tuple<string, stri
688685

689686
// Unfortunately, there is a separate process for Links and Satellites
690687
// Iterate through the various keys (mainly for the purpose of evaluating Links)
691-
int numberOfDependents = 0;
688+
List<string> dependents = new List<string>();
689+
692690
if (tableClassification == teamConfiguration.SatTablePrefixValue || tableClassification == "LNK")
693691
{
694692
foreach (string businessKeyComponent in hubBusinessKeys)
@@ -721,11 +719,11 @@ internal static Dictionary<string, bool> ValidateLogicalGroup(Tuple<string, stri
721719
sourceFullyQualifiedName.Key + '.' + sourceFullyQualifiedName.Value == validationObject.Item1 &&
722720
(string)dataObjectMappingRow[DataObjectMappingGridColumns.BusinessKeyDefinition.ToString()] == businessKeyComponent.Trim() &&
723721
targetFullyQualifiedName.Key + '.' + targetFullyQualifiedName.Value != validationObject.Item2 && // Exclude itself
724-
filterCriterion == validationObject.Item4 && // Adding filtercriterion for uniquification of join (see https://github.com/RoelantVos/TEAM/issues/87);
722+
//filterCriterion == validationObject.Item4 && // Adding filtercriterion for uniquification of join (see https://github.com/RoelantVos/TEAM/issues/87);
725723
targetFullyQualifiedName.Value.StartsWith(tableInclusionFilterCriterion)
726724
)
727725
{
728-
numberOfDependents++;
726+
dependents.Add(validationTargetDataObject.Name);
729727
}
730728
}
731729
}
@@ -755,7 +753,7 @@ internal static Dictionary<string, bool> ValidateLogicalGroup(Tuple<string, stri
755753
targetFullyQualifiedName.Value.StartsWith(tableInclusionFilterCriterion)
756754
)
757755
{
758-
numberOfDependents++;
756+
dependents.Add(validationTargetDataObject.Name);
759757
}
760758
}
761759
catch (Exception)
@@ -768,11 +766,11 @@ internal static Dictionary<string, bool> ValidateLogicalGroup(Tuple<string, stri
768766
// Run the comparison
769767
// Test for equality.
770768
bool equal;
771-
if ((tableClassification == teamConfiguration.SatTablePrefixValue || tableClassification == "LNK") && businessKeyCount == numberOfDependents) // For Sats and Links we can count the keys and rows
769+
if ((tableClassification == teamConfiguration.SatTablePrefixValue || tableClassification == "LNK") && businessKeyCount <= dependents.Count) // For Sats and Links we can count the keys and rows
772770
{
773771
equal = true;
774772
}
775-
else if (tableClassification == "LSAT" && numberOfDependents == 1)
773+
else if (tableClassification == "LSAT" && dependents.Count == 1)
776774
{
777775
equal = true;
778776
}
@@ -783,7 +781,8 @@ internal static Dictionary<string, bool> ValidateLogicalGroup(Tuple<string, stri
783781

784782
// return the result of the test;
785783
Dictionary<string, bool> result = new Dictionary<string, bool>();
786-
result.Add(validationObject.Item2, equal);
784+
var concatenatedObject = $"{validationObject.Item2} - ({validationObject.Item1} {validationObject.Item2} {validationObject.Item3} {validationObject.Item4})";
785+
result.Add(concatenatedObject, equal);
787786
return result;
788787
}
789788

0 commit comments

Comments
 (0)