diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-03-27 13:54:56 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-03-30 21:30:04 +1000 |
commit | 0baf6e26ec7ab2ff0b6ad36e9d44f3d68819b5d6 (patch) | |
tree | 1ef577d0246b662f4a8bda0ed935e987f03562a0 /src/test/WixToolsetTest.CoreIntegration | |
parent | afbc6889c73d58136cb8851858ca3c17f41dc2c5 (diff) | |
download | wix-0baf6e26ec7ab2ff0b6ad36e9d44f3d68819b5d6.tar.gz wix-0baf6e26ec7ab2ff0b6ad36e9d44f3d68819b5d6.tar.bz2 wix-0baf6e26ec7ab2ff0b6ad36e9d44f3d68819b5d6.zip |
Add ability for extensions to create custom bundle searches.
This required creating BundleExtensionData.xml.
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration')
4 files changed, 77 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs index da4482ff..80f7b875 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs | |||
@@ -2,8 +2,10 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
6 | using System.IO; | 7 | using System.IO; |
8 | using Example.Extension; | ||
7 | using WixBuildTools.TestSupport; | 9 | using WixBuildTools.TestSupport; |
8 | using WixToolset.Core.TestPackage; | 10 | using WixToolset.Core.TestPackage; |
9 | using Xunit; | 11 | using Xunit; |
@@ -57,5 +59,59 @@ namespace WixToolsetTest.CoreIntegration | |||
57 | Assert.Equal("<Payload Id='ExampleBext' FilePath='fakebext.dll' FileSize='*' Hash='*' Packaging='embedded' SourcePath='*' />", bundleExtensionPayloads[0].GetTestXml(ignored)); | 59 | Assert.Equal("<Payload Id='ExampleBext' FilePath='fakebext.dll' FileSize='*' Hash='*' Packaging='embedded' SourcePath='*' />", bundleExtensionPayloads[0].GetTestXml(ignored)); |
58 | } | 60 | } |
59 | } | 61 | } |
62 | |||
63 | [Fact] | ||
64 | public void PopulatesManifestWithBundleExtensionSearches() | ||
65 | { | ||
66 | var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); | ||
67 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
68 | var folder = TestData.Get(@"TestData"); | ||
69 | |||
70 | using (var fs = new DisposableFileSystem()) | ||
71 | { | ||
72 | var baseFolder = fs.GetFolder(); | ||
73 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
74 | var bundlePath = Path.Combine(baseFolder, @"bin\test.exe"); | ||
75 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
76 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
77 | |||
78 | var result = WixRunner.Execute(new[] | ||
79 | { | ||
80 | "build", | ||
81 | Path.Combine(folder, "BundleExtension", "BundleExtensionSearches.wxs"), | ||
82 | Path.Combine(folder, "BundleExtension", "BundleWithSearches.wxs"), | ||
83 | Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), | ||
84 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | ||
85 | "-ext", extensionPath, | ||
86 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
87 | "-intermediateFolder", intermediateFolder, | ||
88 | "-burnStub", burnStubPath, | ||
89 | "-o", bundlePath | ||
90 | }); | ||
91 | |||
92 | result.AssertSuccess(); | ||
93 | |||
94 | Assert.True(File.Exists(bundlePath)); | ||
95 | |||
96 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | ||
97 | extractResult.AssertSuccess(); | ||
98 | |||
99 | var bundleExtensions = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:BundleExtension"); | ||
100 | Assert.Equal(1, bundleExtensions.Count); | ||
101 | Assert.Equal("<BundleExtension Id='ExampleBundleExtension' EntryPayloadId='ExampleBundleExtension' />", bundleExtensions[0].GetTestXml()); | ||
102 | |||
103 | var extensionSearches = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:ExtensionSearch"); | ||
104 | Assert.Equal(2, extensionSearches.Count); | ||
105 | Assert.Equal("<ExtensionSearch Id='ExampleSearchBar' Variable='SearchBar' Condition='WixBundleInstalled' ExtensionId='ExampleBundleExtension' />", extensionSearches[0].GetTestXml()); | ||
106 | Assert.Equal("<ExtensionSearch Id='ExampleSearchFoo' Variable='SearchFoo' ExtensionId='ExampleBundleExtension' />", extensionSearches[1].GetTestXml()); | ||
107 | |||
108 | var bundleExtensionDatas = extractResult.SelectBundleExtensionDataNodes("/be:BundleExtensionData/be:BundleExtension[@Id='ExampleBundleExtension']"); | ||
109 | Assert.Equal(1, bundleExtensionDatas.Count); | ||
110 | Assert.Equal("<BundleExtension Id='ExampleBundleExtension'>" + | ||
111 | "<ExampleSearch Id='ExampleSearchBar' SearchFor='Bar' />" + | ||
112 | "<ExampleSearch Id='ExampleSearchFoo' SearchFor='Foo' />" + | ||
113 | "</BundleExtension>", bundleExtensionDatas[0].GetTestXml()); | ||
114 | } | ||
115 | } | ||
60 | } | 116 | } |
61 | } | 117 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtensionSearches.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtensionSearches.wxs new file mode 100644 index 00000000..fd8d3698 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtensionSearches.wxs | |||
@@ -0,0 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:ex="http://www.example.com/scheams/v1/wxs"> | ||
4 | <Fragment> | ||
5 | <ex:ExampleSearch Id="ExampleSearchBar" Variable="SearchBar" Condition="WixBundleInstalled" SearchFor="Bar" /> | ||
6 | <ex:ExampleSearch Id="ExampleSearchFoo" Variable="SearchFoo" SearchFor="Foo" /> | ||
7 | </Fragment> | ||
8 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleWithSearches.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleWithSearches.wxs new file mode 100644 index 00000000..c5a93eb3 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleWithSearches.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:ex="http://www.example.com/scheams/v1/wxs"> | ||
4 | <Fragment> | ||
5 | <PackageGroup Id="BundlePackages"> | ||
6 | <PackageGroupRef Id="MinimalPackageGroup" /> | ||
7 | </PackageGroup> | ||
8 | |||
9 | <ex:ExampleSearchRef Id="ExampleSearchFoo" /> | ||
10 | </Fragment> | ||
11 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 85538b79..324d04ff 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
@@ -22,6 +22,8 @@ | |||
22 | <Content Include="TestData\AppSearch\NestedDirSearchUnderRegSearch.msi" CopyToOutputDirectory="PreserveNewest" /> | 22 | <Content Include="TestData\AppSearch\NestedDirSearchUnderRegSearch.msi" CopyToOutputDirectory="PreserveNewest" /> |
23 | <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" /> | 23 | <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" /> |
24 | <Content Include="TestData\BundleExtension\BundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> | 24 | <Content Include="TestData\BundleExtension\BundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> |
25 | <Content Include="TestData\BundleExtension\BundleExtensionSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
26 | <Content Include="TestData\BundleExtension\BundleWithSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
25 | <Content Include="TestData\BundleExtension\SimpleBundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> | 27 | <Content Include="TestData\BundleExtension\SimpleBundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> |
26 | <Content Include="TestData\BundleWithPackageGroupRef\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | 28 | <Content Include="TestData\BundleWithPackageGroupRef\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> |
27 | <Content Include="TestData\BundleWithPackageGroupRef\MinimalPackageGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> | 29 | <Content Include="TestData\BundleWithPackageGroupRef\MinimalPackageGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> |