Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/SIL.LCModel.FixData/FwDataFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ internal override bool FixElement(XElement rt, ErrorLogger errorLogger)
errorLogger(String.Format(Strings.ksRemovingObjectWithBadOwner, guidOwner, className, guid), true);
return false;
}
else
{
errorLogger(String.Format(Strings.ksRemovingDisownedObject, guidOwner, className, guid), true);
return false;
}
}
}
else if (storedOwner != Guid.Empty)
Expand Down
9 changes: 9 additions & 0 deletions src/SIL.LCModel.FixData/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/SIL.LCModel.FixData/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@
<data name="ksRemovingObjectWithBadOwner" xml:space="preserve">
<value>Removing object with nonexistent owner (invalid ownerguid='{0}', class='{1}', guid='{2}').</value>
</data>
<data name="ksRemovingDisownedObject" xml:space="preserve">
<value>Removing disowned object (invalid ownerguid='{0}', class='{1}', guid='{2}').</value>
</data>
<data name="ksAddingLinkToOwner" xml:space="preserve">
<value>Adding ownerguid='{0}' (class='{1}', guid='{2}').</value>
</data>
Expand Down
10 changes: 8 additions & 2 deletions tests/SIL.LCModel.FixData.Tests/FwDataFixerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ public void DanglingWordformLinks()
var danglingMorphGoodSenseGuid = "9665bf3b-2aab-4f7f-88a9-4ca738b75110";
var danglingMorphNoRepairGuid = "5752ed24-40e1-4282-9ba0-d82c89592432";
var danglingMorphNoRepairAfGuid = "1f568cae-b0f8-413d-84a6-41cbd90923e9";
var disownedOwnerGuid = "16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d";
var disownedGuid = "1f568cae-b0f8-413d-84a6-41cbd90923e9";

// Verify initial state.
// We start out with morph bundles that have broken links.
Expand All @@ -463,7 +465,7 @@ public void DanglingWordformLinks()
"//rt[@class=\"WfiMorphBundle\" and @guid=\"" + danglingMorphNoRepairAfGuid + "\"]/Morph/objsur[@guid=\"" + danglingMsaGuid + "\"]", 1);

// Check errors
Assert.AreEqual(10, _errors.Count, "Unexpected number of errors found.");
Assert.AreEqual(11, _errors.Count, "Unexpected number of errors found.");
Assert.True(_errors[0].StartsWith("Removing dangling link to '" + danglingMsaGuid + "' (class='LexEntry'"),
"Error message is incorrect."); // OriginalFixer--ksRemovingLinkToNonexistingObject
Assert.That(_errors[1], Is.EqualTo("Fixing link to MSA based on Sense MSA (class='WfiMorphBundle', guid='" + repairableBundleGuid + "')."),
Expand All @@ -480,7 +482,9 @@ public void DanglingWordformLinks()
"Error message is incorrect."); // MorphBundleFixer--ksRemovingDanglingMsa
Assert.That(_errors[8], Is.EqualTo("Removing dangling link to Form '" + danglingMsaGuid + "' for WfiMorphBundle '" + danglingMorphNoRepairGuid + "'."),
"Error message is incorrect."); // MorphBundleFixer--ksRemovingDanglingMorph
Assert.That(_errors[9], Is.EqualTo("Removing dangling link to Form '" + danglingMsaGuid + "' for WfiMorphBundle '" + danglingMorphNoRepairAfGuid + "'."),
Assert.True(_errors[9].StartsWith("Removing disowned object (invalid ownerguid='" + disownedOwnerGuid + "', class='WfiMorphBundle', guid='" + disownedGuid),
"Error message is incorrect."); // MorphBundleFixer--ksRemovingDanglingMorph
Assert.That(_errors[10], Is.EqualTo("Removing dangling link to Form '" + danglingMsaGuid + "' for WfiMorphBundle '" + danglingMorphNoRepairAfGuid + "'."),
"Error message is incorrect."); // MorphBundleFixer--ksRemovingDanglingMorph

// Check file repair
Expand All @@ -498,6 +502,8 @@ public void DanglingWordformLinks()
"//rt[@class=\"WfiMorphBundle\" and @guid=\"" + danglingMorphNoRepairGuid + "\"]/Morph", 0); // must remove Morph, not just child objsur
AssertThatXmlIn.File(Path.Combine(testPath, "BasicFixup.fwdata")).HasSpecifiedNumberOfMatchesForXpath(
"//rt[@class=\"WfiMorphBundle\" and @guid=\"" + danglingMorphNoRepairAfGuid + "\"]/Morph/objsur", 0);
AssertThatXmlIn.File(Path.Combine(testPath, "BasicFixup.fwdata")).HasSpecifiedNumberOfMatchesForXpath(
"//rt[@class=\"WfiMorphBundle\" and @guid=\"" + disownedGuid + "\"]/Morph/objsur", 0);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

<rt class="WfiWordform" guid ="31c5a1c0-270e-4edf-9406-4ed445bd27c4">
<Analyses>
<objsur guid="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d" type="o"/>
<objsur guid="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d" t="o"/>
</Analyses>
</rt>
<rt class="WfiAnalysis" guid ="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d" ownerguid="31c5a1c0-270e-4edf-9406-4ed445bd27c4">
<MorphBundles>
<objsur guid="10f3db1e-33db-4d9d-9a06-e0a8e1ed8a92" type="o"/>
<objsur guid="10f3db1e-33db-4d9d-9a06-e0a8e1ed8a92" t="o"/>
</MorphBundles>
</rt>
<rt class="WfiMorphBundle" guid ="10f3db1e-33db-4d9d-9a06-e0a8e1ed8a92" ownerguid="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@

<rt class="WfiWordform" guid ="31c5a1c0-270e-4edf-9406-4ed445bd27c4">
<Analyses>
<objsur guid="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d" type="o"/>
<objsur guid="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d" t="o"/>
</Analyses>
</rt>
<rt class="WfiAnalysis" guid ="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d" ownerguid="31c5a1c0-270e-4edf-9406-4ed445bd27c4">
<MorphBundles>
<objsur guid="10f3db1e-33db-4d9d-9a06-e0a8e1ed8a92" type="o"/>
<objsur guid="10f3db1e-33db-4d9d-9a06-e0a8e1ed8a92" t="o"/>
<objsur guid="d70b57bc-ecfe-4e32-a590-f2852bce69fc" t="o"/>
<objsur guid="e4396e8e-b7d2-43ba-93bd-104cf2011aaf" t="o"/>
<objsur guid="cb941dc9-6f6e-44b2-97f2-07854e164b4e" t="o"/>
<objsur guid="9665bf3b-2aab-4f7f-88a9-4ca738b75110" t="o"/>
<objsur guid="5752ed24-40e1-4282-9ba0-d82c89592432" t="o"/>
</MorphBundles>
</rt>
<rt class="WfiMorphBundle" guid ="10f3db1e-33db-4d9d-9a06-e0a8e1ed8a92" ownerguid="16827d7a-cf4e-45f8-aaa1-66cef5c2cc4d">
Expand Down
Loading