From 717ac8183b04da445b751865deb40330e5da87c3 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Fri, 4 Apr 2025 19:19:56 -0400 Subject: Sync IEngine.SetUpdateSource with native side. Fixes https://github.com/wixtoolset/issues/issues/9023 --- .../Engine.cs | 4 +-- .../IBootstrapperEngine.cs | 3 ++- .../IEngine.cs | 3 ++- src/test/burn/TestBA/TestBA.cs | 20 ++++++++++++++ .../TestData/FailureTests/BundleUpdate/Bundle.wxs | 31 ++++++++++++++++++++++ .../FailureTests/BundleUpdate/BundleUpdate.wixproj | 16 +++++++++++ .../burn/WixToolsetTest.BurnE2E/FailureTests.cs | 18 +++++++++++++ .../Utilities/TestBAController.cs | 5 ++++ 8 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 src/test/burn/TestData/FailureTests/BundleUpdate/Bundle.wxs create mode 100644 src/test/burn/TestData/FailureTests/BundleUpdate/BundleUpdate.wixproj diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs index 52ac90c5..25413790 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs @@ -259,9 +259,9 @@ namespace WixToolset.BootstrapperApplicationApi } /// - public void SetUpdateSource(string url) + public void SetUpdateSource(string url, string authorizationHeader) { - this.engine.SetUpdateSource(url); + this.engine.SetUpdateSource(url, authorizationHeader); } /// diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs index 172bafe8..13702757 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs @@ -220,7 +220,8 @@ namespace WixToolset.BootstrapperApplicationApi /// Sets the URL to the update feed. /// void SetUpdateSource( - [MarshalAs(UnmanagedType.LPWStr)] string url + [MarshalAs(UnmanagedType.LPWStr)] string url, + [MarshalAs(UnmanagedType.LPWStr)] string wzAuthorizationHeader ); /// diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs index ca423309..03ceed06 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs @@ -156,7 +156,8 @@ namespace WixToolset.BootstrapperApplicationApi /// Sets the URL to the update feed. /// /// URL of the update feed. - void SetUpdateSource(string url); + /// Additional proxy authentication header. Not currently used. + void SetUpdateSource(string url, string authorizationHeader); /// /// Set the local source for a package or container. diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs index 4f75a055..51fc1cbd 100644 --- a/src/test/burn/TestBA/TestBA.cs +++ b/src/test/burn/TestBA/TestBA.cs @@ -42,6 +42,7 @@ namespace WixToolset.Test.BA private int retryExecuteFilesInUse; private bool rollingBack; private string forceDownloadSource; + private string forceUpdateSource; private IBootstrapperCommand Command { get; set; } @@ -217,9 +218,28 @@ namespace WixToolset.Test.BA } } + protected override void OnDetectBegin(DetectBeginEventArgs args) + { + this.Log("OnDetectBegin"); + + this.forceUpdateSource = this.ReadPackageAction(null, "ForceUpdateSource"); + if (!String.IsNullOrEmpty(this.forceUpdateSource)) + { + this.Log(" OnDetectBegin::ForceUpdateSource: {0}", this.forceUpdateSource); + } + + } + protected override void OnDetectUpdateBegin(DetectUpdateBeginEventArgs args) { this.Log("OnDetectUpdateBegin"); + + if (!String.IsNullOrEmpty(this.forceUpdateSource)) + { + this.Log(" OnDetectUpdateBegin::ForceUpdateSource: {0}", this.forceUpdateSource); + this.Engine.SetUpdateSource(this.forceUpdateSource, String.Empty); + } + if (LaunchAction.UpdateReplaceEmbedded == this.action || LaunchAction.UpdateReplace == this.action) { args.Skip = false; diff --git a/src/test/burn/TestData/FailureTests/BundleUpdate/Bundle.wxs b/src/test/burn/TestData/FailureTests/BundleUpdate/Bundle.wxs new file mode 100644 index 00000000..0af817c1 --- /dev/null +++ b/src/test/burn/TestData/FailureTests/BundleUpdate/Bundle.wxs @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/FailureTests/BundleUpdate/BundleUpdate.wixproj b/src/test/burn/TestData/FailureTests/BundleUpdate/BundleUpdate.wixproj new file mode 100644 index 00000000..34ab1aef --- /dev/null +++ b/src/test/burn/TestData/FailureTests/BundleUpdate/BundleUpdate.wixproj @@ -0,0 +1,16 @@ + + + + Bundle + {C60B9483-CE87-4FDA-AE5A-B39A52E956E8} + + + + + + + + + + + diff --git a/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs index 4bbfc7e9..7d399df0 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs @@ -29,6 +29,24 @@ namespace WixToolsetTest.BurnE2E packageA.VerifyInstalled(false); } + [RuntimeFact] + public void CanSetUpdateSource() + { + var packageA = this.CreatePackageInstaller("PackageA"); + var bundleA = this.CreateBundleInstaller("BundleUpdate"); + var testBAController = this.CreateTestBAController(); + + testBAController.SetForceUpdateSource("https://1e1bf2be1c384fd1a0c4c0500eef971b/update_feed.atom.xml"); + + packageA.VerifyInstalled(false); + + bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); + + bundleA.Install(); + + packageA.VerifyInstalled(true); + } + [RuntimeFact] public void CanCancelExePackageAndAbandonIt() { diff --git a/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs index ca395f56..c344ebce 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs @@ -67,6 +67,11 @@ namespace WixToolsetTest.BurnE2E this.SetBurnTestValue("QuitAfterDetect", value); } + public void SetForceUpdateSource(string url) + { + this.SetBurnTestValue("ForceUpdateSource", url); + } + /// /// Slows the cache progress of a package. /// -- cgit v1.2.3-55-g6feb