aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-03-30 21:51:33 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-03-30 22:05:07 -0500
commit87ffd980dc518a7ab40901eeae27b75259ea32b0 (patch)
tree32e2d3ce966d0017c1ce86a83f21329417411406 /src/test
parentf533d01010a3e5d8a93b4be1e1820e4668542a3a (diff)
downloadwix-87ffd980dc518a7ab40901eeae27b75259ea32b0.tar.gz
wix-87ffd980dc518a7ab40901eeae27b75259ea32b0.tar.bz2
wix-87ffd980dc518a7ab40901eeae27b75259ea32b0.zip
Add failing test for DownloadUrl placeholder replacement.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs61
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Payload/DownloadUrlPlaceholdersBundle.wxs30
2 files changed, 91 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs
index 5b6bbeb5..9bd33eac 100644
--- a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs
@@ -6,6 +6,7 @@ namespace WixToolsetTest.CoreIntegration
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.IO; 7 using System.IO;
8 using System.Linq; 8 using System.Linq;
9 using System.Xml;
9 using WixBuildTools.TestSupport; 10 using WixBuildTools.TestSupport;
10 using WixToolset.Core.TestPackage; 11 using WixToolset.Core.TestPackage;
11 using WixToolset.Data; 12 using WixToolset.Data;
@@ -141,5 +142,65 @@ namespace WixToolsetTest.CoreIntegration
141 Assert.InRange(result.ExitCode, 2, int.MaxValue); 142 Assert.InRange(result.ExitCode, 2, int.MaxValue);
142 } 143 }
143 } 144 }
145
146 [Fact(Skip = "Test demonstrates failure")]
147 public void ReplacesDownloadUrlPlaceholders()
148 {
149 var folder = TestData.Get(@"TestData");
150
151 using (var fs = new DisposableFileSystem())
152 {
153 var baseFolder = fs.GetFolder();
154 var intermediateFolder = Path.Combine(baseFolder, "obj");
155 var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
156 var baFolderPath = Path.Combine(baseFolder, "ba");
157 var extractFolderPath = Path.Combine(baseFolder, "extract");
158
159 var result = WixRunner.Execute(new[]
160 {
161 "build",
162 Path.Combine(folder, "Payload", "DownloadUrlPlaceholdersBundle.wxs"),
163 Path.Combine(folder, "SimpleBundle", "MultiFileBootstrapperApplication.wxs"),
164 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
165 "-bindpath", Path.Combine(folder, ".Data"),
166 "-intermediateFolder", intermediateFolder,
167 "-o", bundlePath,
168 });
169
170 result.AssertSuccess();
171
172 Assert.True(File.Exists(bundlePath));
173
174 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
175 extractResult.AssertSuccess();
176
177 var ignoreAttributesByElementName = new Dictionary<string, List<string>>
178 {
179 { "Container", new List<string> { "FileSize", "Hash" } },
180 { "Payload", new List<string> { "FileSize", "Hash" } },
181 };
182 var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload")
183 .Cast<XmlElement>()
184 .Select(e => e.GetTestXml(ignoreAttributesByElementName))
185 .ToArray();
186 WixAssert.CompareLineByLine(new string[]
187 {
188 "<Payload Id='burn.exe' FilePath='burn.exe' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a0' Container='PackagesContainer' />",
189 "<Payload Id='test.msi' FilePath='test.msi' FileSize='*' Hash='*' DownloadUrl='http://example.com/id/test.msi/test.msi' Packaging='external' SourcePath='test.msi' />",
190 "<Payload Id='LayoutOnlyPayload' FilePath='DownloadUrlPlaceholdersBundle.wxs' FileSize='*' Hash='*' LayoutOnly='yes' DownloadUrl='http://example.com/id/LayoutOnlyPayload/DownloadUrlPlaceholdersBundle.wxs' Packaging='external' SourcePath='DownloadUrlPlaceholdersBundle.wxs' />",
191 @"<Payload Id='fhuZsOcBDTuIX8rF96kswqI6SnuI' FilePath='MsiPackage\test.txt' FileSize='*' Hash='*' Packaging='external' SourcePath='MsiPackage\test.txt' />",
192 @"<Payload Id='faf_OZ741BG7SJ6ZkcIvivZ2Yzo8' FilePath='MsiPackage\Shared.dll' FileSize='*' Hash='*' Packaging='external' SourcePath='MsiPackage\Shared.dll' />",
193 }, payloads);
194
195 var containers = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Container")
196 .Cast<XmlElement>()
197 .Select(e => e.GetTestXml(ignoreAttributesByElementName))
198 .ToArray();
199 WixAssert.CompareLineByLine(new string[]
200 {
201 "<Container Id='PackagesContainer' FileSize='*' Hash='*' DownloadUrl='http://example.com/id/PackagesContainer/packages.cab' FilePath='packages.cab' />",
202 }, containers);
203 }
204 }
144 } 205 }
145} 206}
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/DownloadUrlPlaceholdersBundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/DownloadUrlPlaceholdersBundle.wxs
new file mode 100644
index 00000000..87bb79f9
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/DownloadUrlPlaceholdersBundle.wxs
@@ -0,0 +1,30 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Bundle Name="DownloadUrlPlaceholders" Version="1.0.0.0" Manufacturer="test" UpgradeCode="{B04C20B8-70C3-4DE1-8D91-4F11C7C68DED}">
3 <BootstrapperApplicationRef Id="fakeba" />
4
5 <Chain>
6 <PackageGroupRef Id="ContainerPackages" />
7 <PackageGroupRef Id="UncompressedPackages" />
8 </Chain>
9
10 <PayloadGroupRef Id="LayoutOnlyPayloads" />
11 <Container Id="PackagesContainer" Name="packages.cab" DownloadUrl="http://example.com/{0}id/{1}/{2}">
12 <PackageGroupRef Id="ContainerPackages" />
13 </Container>
14 </Bundle>
15 <Fragment>
16 <PackageGroup Id="ContainerPackages">
17 <ExePackage SourceFile="burn.exe" DetectCondition="none" />
18 </PackageGroup>
19 </Fragment>
20 <Fragment>
21 <PackageGroup Id="UncompressedPackages">
22 <MsiPackage SourceFile="test.msi" DownloadUrl="http://example.com/{0}id/{1}/{2}" Compressed="no" />
23 </PackageGroup>
24 </Fragment>
25 <Fragment>
26 <PayloadGroup Id="LayoutOnlyPayloads">
27 <Payload Id="LayoutOnlyPayload" SourceFile="$(sys.SOURCEFILEPATH)" DownloadUrl="http://example.com/{0}id/{1}/{2}" Compressed="no" />
28 </PayloadGroup>
29 </Fragment>
30</Wix>