diff options
| author | Bob Arnson <bob@firegiant.com> | 2025-04-01 16:48:38 -0400 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2025-04-01 16:48:38 -0400 |
| commit | 28fd5a981792e0ba4eeeb5d2ac431d12e1c214ec (patch) | |
| tree | f28efef38caaa0980ea24e5fa674f952646b649b | |
| parent | ed19d167c0d3071709a72143f106dbb5efdddeba (diff) | |
| download | wix-bob/FixIEngineSetDownloadSource.tar.gz wix-bob/FixIEngineSetDownloadSource.tar.bz2 wix-bob/FixIEngineSetDownloadSource.zip | |
Sync IEngine.SetDownloadSource with native side.bob/FixIEngineSetDownloadSource
Fixes https://github.com/wixtoolset/issues/issues/9018
7 files changed, 67 insertions, 8 deletions
diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs index 44d77359..52ac90c5 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs | |||
| @@ -271,9 +271,9 @@ namespace WixToolset.BootstrapperApplicationApi | |||
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | /// <inheritdoc/> | 273 | /// <inheritdoc/> |
| 274 | public void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password) | 274 | public void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password, string authorizationHeader) |
| 275 | { | 275 | { |
| 276 | this.engine.SetDownloadSource(packageOrContainerId, payloadId, url, user, password); | 276 | this.engine.SetDownloadSource(packageOrContainerId, payloadId, url, user, password, authorizationHeader); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | /// <inheritdoc/> | 279 | /// <inheritdoc/> |
diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs index c7b0c003..dbfe552d 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs | |||
| @@ -129,14 +129,15 @@ namespace WixToolset.BootstrapperApplicationApi | |||
| 129 | ); | 129 | ); |
| 130 | 130 | ||
| 131 | /// <summary> | 131 | /// <summary> |
| 132 | /// See <see cref="IEngine.SetDownloadSource(string, string, string, string, string)"/>. | 132 | /// See <see cref="IEngine.SetDownloadSource(string, string, string, string, string, string)"/>. |
| 133 | /// </summary> | 133 | /// </summary> |
| 134 | void SetDownloadSource( | 134 | void SetDownloadSource( |
| 135 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | 135 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, |
| 136 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | 136 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, |
| 137 | [MarshalAs(UnmanagedType.LPWStr)] string wzUrl, | 137 | [MarshalAs(UnmanagedType.LPWStr)] string wzUrl, |
| 138 | [MarshalAs(UnmanagedType.LPWStr)] string wzUser, | 138 | [MarshalAs(UnmanagedType.LPWStr)] string wzUser, |
| 139 | [MarshalAs(UnmanagedType.LPWStr)] string wzPassword | 139 | [MarshalAs(UnmanagedType.LPWStr)] string wzPassword, |
| 140 | [MarshalAs(UnmanagedType.LPWStr)] string authorizationHeader | ||
| 140 | ); | 141 | ); |
| 141 | 142 | ||
| 142 | /// <summary> | 143 | /// <summary> |
diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs index ad51b2be..1ff12c28 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs | |||
| @@ -37,14 +37,14 @@ namespace WixToolset.BootstrapperApplicationApi | |||
| 37 | /// <summary> | 37 | /// <summary> |
| 38 | /// Fired when the engine has begun acquiring the payload or container. | 38 | /// Fired when the engine has begun acquiring the payload or container. |
| 39 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(String, String, String)"/> | 39 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(String, String, String)"/> |
| 40 | /// or <see cref="IEngine.SetDownloadSource(String, String, String, String, String)"/>. | 40 | /// or <see cref="IEngine.SetDownloadSource(String, String, String, String, String, String)"/>. |
| 41 | /// </summary> | 41 | /// </summary> |
| 42 | event EventHandler<CacheAcquireBeginEventArgs> CacheAcquireBegin; | 42 | event EventHandler<CacheAcquireBeginEventArgs> CacheAcquireBegin; |
| 43 | 43 | ||
| 44 | /// <summary> | 44 | /// <summary> |
| 45 | /// Fired when the engine has completed the acquisition of the payload or container. | 45 | /// Fired when the engine has completed the acquisition of the payload or container. |
| 46 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(String, String, String)"/> | 46 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(String, String, String)"/> |
| 47 | /// or <see cref="IEngine.SetDownloadSource(String, String, String, String, String)"/>. | 47 | /// or <see cref="IEngine.SetDownloadSource(String, String, String, String, String, String)"/>. |
| 48 | /// </summary> | 48 | /// </summary> |
| 49 | event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; | 49 | event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; |
| 50 | 50 | ||
diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs index bd78409b..ca423309 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs | |||
| @@ -174,7 +174,8 @@ namespace WixToolset.BootstrapperApplicationApi | |||
| 174 | /// <param name="url">The new url.</param> | 174 | /// <param name="url">The new url.</param> |
| 175 | /// <param name="user">The user name for proxy authentication.</param> | 175 | /// <param name="user">The user name for proxy authentication.</param> |
| 176 | /// <param name="password">The password for proxy authentication.</param> | 176 | /// <param name="password">The password for proxy authentication.</param> |
| 177 | void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password); | 177 | /// <param name="authorizationHeader">Additional proxy authentication header. Not currently used.</param> |
| 178 | void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password, string authorizationHeader); | ||
| 178 | 179 | ||
| 179 | /// <summary> | 180 | /// <summary> |
| 180 | /// Sets numeric variables for the engine. | 181 | /// Sets numeric variables for the engine. |
diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs index 1556acd0..4f75a055 100644 --- a/src/test/burn/TestBA/TestBA.cs +++ b/src/test/burn/TestBA/TestBA.cs | |||
| @@ -41,6 +41,7 @@ namespace WixToolset.Test.BA | |||
| 41 | private int cancelOnProgressAtProgress; | 41 | private int cancelOnProgressAtProgress; |
| 42 | private int retryExecuteFilesInUse; | 42 | private int retryExecuteFilesInUse; |
| 43 | private bool rollingBack; | 43 | private bool rollingBack; |
| 44 | private string forceDownloadSource; | ||
| 44 | 45 | ||
| 45 | private IBootstrapperCommand Command { get; set; } | 46 | private IBootstrapperCommand Command { get; set; } |
| 46 | 47 | ||
| @@ -375,6 +376,12 @@ namespace WixToolset.Test.BA | |||
| 375 | { | 376 | { |
| 376 | this.Log(" CancelCacheAtProgress: {0}", this.cancelCacheAtProgress); | 377 | this.Log(" CancelCacheAtProgress: {0}", this.cancelCacheAtProgress); |
| 377 | } | 378 | } |
| 379 | |||
| 380 | this.forceDownloadSource = this.ReadPackageAction(args.PackageId, "ForceDownloadSource"); | ||
| 381 | if (!String.IsNullOrEmpty(this.forceDownloadSource)) | ||
| 382 | { | ||
| 383 | this.Log(" ForceDownloadSource: {0}", this.forceDownloadSource); | ||
| 384 | } | ||
| 378 | } | 385 | } |
| 379 | 386 | ||
| 380 | protected override void OnCachePackageNonVitalValidationFailure(CachePackageNonVitalValidationFailureEventArgs args) | 387 | protected override void OnCachePackageNonVitalValidationFailure(CachePackageNonVitalValidationFailureEventArgs args) |
| @@ -387,6 +394,29 @@ namespace WixToolset.Test.BA | |||
| 387 | this.Log("OnCachePackageNonVitalValidationFailure() - id: {0}, default: {1}, requested: {2}", args.PackageId, args.Recommendation, args.Action); | 394 | this.Log("OnCachePackageNonVitalValidationFailure() - id: {0}, default: {1}, requested: {2}", args.PackageId, args.Recommendation, args.Action); |
| 388 | } | 395 | } |
| 389 | 396 | ||
| 397 | protected override void OnCacheAcquireResolving(CacheAcquireResolvingEventArgs args) | ||
| 398 | { | ||
| 399 | if (!String.IsNullOrEmpty(this.forceDownloadSource)) | ||
| 400 | { | ||
| 401 | args.Action = CacheResolveOperation.Download; | ||
| 402 | var url = String.Format(this.forceDownloadSource, args.PayloadId); | ||
| 403 | |||
| 404 | this.Log("OnCacheAcquireResolving: {0} => {1}", this.forceDownloadSource, url); | ||
| 405 | |||
| 406 | this.engine.SetDownloadSource( | ||
| 407 | String.Empty, | ||
| 408 | args.PayloadId, | ||
| 409 | url, | ||
| 410 | String.Empty, | ||
| 411 | String.Empty, | ||
| 412 | String.Empty); | ||
| 413 | } | ||
| 414 | else | ||
| 415 | { | ||
| 416 | this.Log("OnCacheAcquireResolving not forcing download"); | ||
| 417 | } | ||
| 418 | } | ||
| 419 | |||
| 390 | protected override void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args) | 420 | protected override void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args) |
| 391 | { | 421 | { |
| 392 | this.Log("OnCacheAcquireProgress() - container/package: {0}, payload: {1}, progress: {2}, total: {3}, overall progress: {4}%", args.PackageOrContainerId, args.PayloadId, args.Progress, args.Total, args.OverallPercentage); | 422 | this.Log("OnCacheAcquireProgress() - container/package: {0}, payload: {1}, progress: {2}, total: {3}, overall progress: {4}%", args.PackageOrContainerId, args.PayloadId, args.Progress, args.Total, args.OverallPercentage); |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs index bd3762ed..4bbfc7e9 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | namespace WixToolsetTest.BurnE2E | 3 | namespace WixToolsetTest.BurnE2E |
| 4 | { | 4 | { |
| 5 | using System.Threading; | ||
| 6 | using WixTestTools; | 5 | using WixTestTools; |
| 7 | using WixToolset.BootstrapperApplicationApi; | 6 | using WixToolset.BootstrapperApplicationApi; |
| 8 | using Xunit; | 7 | using Xunit; |
| @@ -13,6 +12,24 @@ namespace WixToolsetTest.BurnE2E | |||
| 13 | public FailureTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | 12 | public FailureTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } |
| 14 | 13 | ||
| 15 | [RuntimeFact] | 14 | [RuntimeFact] |
| 15 | public void CanSetDownloadSourceAndForceDownload() | ||
| 16 | { | ||
| 17 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
| 18 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
| 19 | var testBAController = this.CreateTestBAController(); | ||
| 20 | |||
| 21 | testBAController.SetPackageForceDownloadSource("PackageA", "https://1e1bf2be1c384fd1a0c4c0500eef971b/downloads/payloads/{0}"); | ||
| 22 | |||
| 23 | packageA.VerifyInstalled(false); | ||
| 24 | |||
| 25 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
| 26 | |||
| 27 | bundleA.Install(0x2ee7/*ERROR_INTERNET_NAME_NOT_RESOLVED*/); | ||
| 28 | |||
| 29 | packageA.VerifyInstalled(false); | ||
| 30 | } | ||
| 31 | |||
| 32 | [RuntimeFact] | ||
| 16 | public void CanCancelExePackageAndAbandonIt() | 33 | public void CanCancelExePackageAndAbandonIt() |
| 17 | { | 34 | { |
| 18 | var bundleD = this.CreateBundleInstaller("BundleD"); | 35 | var bundleD = this.CreateBundleInstaller("BundleD"); |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs index a378545e..ca395f56 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs | |||
| @@ -108,6 +108,16 @@ namespace WixToolsetTest.BurnE2E | |||
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | /// <summary> | 110 | /// <summary> |
| 111 | /// Forces a download action and sets the download source. | ||
| 112 | /// </summary> | ||
| 113 | /// <param name="packageId">Package identity.</param> | ||
| 114 | /// <param name="actionName">The URL format string.</param> | ||
| 115 | public void SetPackageForceDownloadSource(string packageId, string url) | ||
| 116 | { | ||
| 117 | this.SetPackageState(packageId, "ForceDownloadSource", url); | ||
| 118 | } | ||
| 119 | |||
| 120 | /// <summary> | ||
| 111 | /// Cancels the execute of a package at the next progess after the specified MSI action start. | 121 | /// Cancels the execute of a package at the next progess after the specified MSI action start. |
| 112 | /// </summary> | 122 | /// </summary> |
| 113 | /// <param name="packageId">Package identity.</param> | 123 | /// <param name="packageId">Package identity.</param> |
