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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

using System;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using System.Xml.Linq;
using System.Xml.XPath;
using SIL.LCModel.Utils;
Expand Down Expand Up @@ -66,7 +66,7 @@ private bool FixExternalLinks(XElement xel, string projectName)
value = kFwUrlPrefix.Substring(0, 1) + value;
if (!value.StartsWith(kFwUrlPrefix))
continue;
string query = HttpUtility.UrlDecode(value.Substring(kFwUrlPrefix.Length));
string query = WebUtility.UrlDecode(value.Substring(kFwUrlPrefix.Length));
string[] rgsProps = query.Split(new char[] {'&'}, StringSplitOptions.RemoveEmptyEntries);
string database = null;
int idxDatabase = -1;
Expand Down Expand Up @@ -130,7 +130,7 @@ private bool FixExternalLinks(XElement xel, string projectName)
if (!fChange)
continue;

value = kFwUrlPrefix + HttpUtility.UrlEncode(string.Join("&", rgsProps));
value = kFwUrlPrefix + WebUtility.UrlEncode(string.Join("&", rgsProps));
if (attrLink.Value != value)
{
attrLink.Value = value;
Expand Down
4 changes: 0 additions & 4 deletions src/SIL.LCModel/SIL.LCModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@
<Clean Include="@(GeneratedFiles)" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Web" />
</ItemGroup>

<Target Name="GenerateModel" Inputs="MasterLCModel.xml" Outputs="@(GeneratedFiles)" BeforeTargets="BeforeCompile">
<!-- Call the LcmGenerate task from SIL.LCModel.Build.Tasks in a separate msbuild process,
so it doesn't lock the SIL.LCModel.Build.Tasks.dll in VS. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System;
using System.Collections.Generic;
using System.Web;
using System.Net;
using System.Xml.Linq;
using System.Xml.XPath;
using NUnit.Framework;
Expand Down Expand Up @@ -122,7 +122,7 @@ private void CheckForValidLinkValue(string externalLink)
}
Assert.IsTrue(externalLink.StartsWith(FwUrlPrefix),
"silfw link should start with " + FwUrlPrefix);
string query = HttpUtility.UrlDecode(externalLink.Substring(FwUrlPrefix.Length));
string query = WebUtility.UrlDecode(externalLink.Substring(FwUrlPrefix.Length));
string[] rgsProps = query.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
string tool = null;
Guid guid = Guid.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using System.Xml.XPath;
using NUnit.Framework;
using SIL.LCModel.Utils;

Expand All @@ -23,8 +21,6 @@ namespace SIL.LCModel.DomainServices.DataMigration
[TestFixture]
public class DataMigration7000040Tests : DataMigrationTestsBase
{
private const string FwUrlPrefix = "silfw://localhost/link?";

///--------------------------------------------------------------------------------------
/// <summary>
/// Test the migration from version 7000039 to 7000040.
Expand Down Expand Up @@ -100,80 +96,5 @@ private void VerifyObjSur(IEnumerable<XElement> osElements, int index, string gu
Assert.That(objsur.Attribute("guid").Value, Is.EqualTo(guid));
Assert.That(objsur.Attribute("t").Value, Is.EqualTo("r"));
}

int m_cLinks;
List<string> m_rgsOtherLinks = new List<string>();

private void CollectionNonSilfwLinks(IDomainObjectDTORepository dtoRepos)
{
foreach (var dto in dtoRepos.AllInstancesWithValidClasses())
{
string xml = dto.Xml;
Assert.IsTrue(xml.Contains("externalLink"), "Every object in the test has an externalLink");
var dtoXML = XElement.Parse(xml);
foreach (var run in dtoXML.XPathSelectElements("//Run"))
{
var externalLinkAttr = run.Attribute("externalLink");
if (externalLinkAttr != null)
{
string value = externalLinkAttr.Value;
if (value.StartsWith("http://") || value.StartsWith("libronixdls:"))
m_rgsOtherLinks.Add(value);
++m_cLinks;
}
}
}

}

private void CheckForValidLinkValue(string externalLink)
{
int idxColon = externalLink.IndexOf(':');
Assert.Greater(idxColon, 0, "links must have a colon to separate off the type of link");
string linkType = externalLink.Substring(0, idxColon);
switch (linkType)
{
case "http":
case "libronixdls":
Assert.IsTrue(m_rgsOtherLinks.Contains(externalLink),
"Migration should not affect http or libronix links");
return;
default:
Assert.AreEqual("silfw", linkType);
break;
}
Assert.IsTrue(externalLink.StartsWith(FwUrlPrefix),
"silfw link should start with " + FwUrlPrefix);
string query = HttpUtility.UrlDecode(externalLink.Substring(FwUrlPrefix.Length));
string[] rgsProps = query.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
string tool = null;
Guid guid = Guid.Empty;
for (int i = 0; i < rgsProps.Length; ++i)
{
string[] propPair = rgsProps[i].Split('=');
switch (propPair[0])
{
case "app":
Assert.AreEqual("flex", propPair[1], "silfw link - app should equal \"flex\"");
break;
case "server":
Assert.That(propPair[1], Is.Null.Or.Empty, "silfw link - server should be empty");
break;
case "database":
Assert.AreEqual("this$", propPair[1], "silfw link - database should equal \"this$\"");
break;
case "tool":
tool = propPair[1];
break;
case "guid":
guid = new Guid(propPair[1]);
break;
default:
break;
}
}
Assert.That(tool, Is.Not.Null.And.Not.Empty, "silfw link - tool should have a value");
Assert.AreNotEqual(Guid.Empty, guid, "silfw link - guid should have a value");
}
}
}
4 changes: 0 additions & 4 deletions tests/SIL.LCModel.Tests/SIL.LCModel.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ This package provides unit tests for SIL.LCModel.</Description>
<ProjectReference Include="..\SIL.LCModel.Core.Tests\SIL.LCModel.Core.Tests.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Web" />
</ItemGroup>

<Target Name="CollectRuntimeOutputs" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<None Include="$(OutputPath)\**\$(PackageId).dll.config" Pack="true" PackagePath="lib" />
Expand Down
Loading