Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinGet Source COM Api #4813

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
874c523
Implement skeleton for package catalog management
Madhusudhan-MSFT Sep 16, 2024
2ba2e77
Add new vector interfaces for package catalog operations
Madhusudhan-MSFT Sep 16, 2024
084e9a7
Add registration for AddPackageCatalogOptions COM class
Madhusudhan-MSFT Sep 16, 2024
8dbdbb8
Add C# WinRT Projection for AddPackageCatalogOptions class
Madhusudhan-MSFT Sep 16, 2024
fb402a1
[PR Feedback:] Refactor AddPackageCatalogOptions and update PackageMa…
Madhusudhan-MSFT Sep 17, 2024
bb0923b
[PR Feedback:] Refactor progress reporting for CatalogPackageAsync me…
Madhusudhan-MSFT Sep 17, 2024
a8e28b7
[PR Feedback:] Refactor package catalog operations to async methods
Madhusudhan-MSFT Sep 17, 2024
c5ccec2
Refactor PackageCatalogReference methods to remove params
Madhusudhan-MSFT Sep 24, 2024
16d41d0
Remove progress reporting from ResetPackageCatalogAsync
Madhusudhan-MSFT Sep 24, 2024
c2d3a0f
Eliminate ResetPackageCatalogAsync in favor of options for RemovePack…
Madhusudhan-MSFT Sep 27, 2024
aeb98ea
Merge branch 'master' of https://github.com/Madhusudhan-MSFT/winget-c…
Madhusudhan-MSFT Oct 9, 2024
e2021d7
[MergeConflictFix:] Add new NameCLSIDPair for AddPackageCatalogOptions
Madhusudhan-MSFT Oct 9, 2024
6410b49
Remove package catalog handling logic for the changes expected in the…
Madhusudhan-MSFT Oct 9, 2024
c41bb16
Apply API review feedback
Madhusudhan-MSFT Oct 14, 2024
aa6de76
Merge branch 'microsoft:master' into user/masudars/WinGet_Source_COM_API
Madhusudhan-MSFT Oct 14, 2024
ac4ae58
Fix typo in comment for AcceptSourceAgreements
Madhusudhan-MSFT Oct 14, 2024
0bf0ad4
Reformat RemovePackageCatalogAsync method declaration
Madhusudhan-MSFT Oct 14, 2024
f1a064a
Add new error codes and update method documentation
Madhusudhan-MSFT Oct 18, 2024
e988965
Add CallbackDispatcherSink class for progress updates
Madhusudhan-MSFT Oct 18, 2024
8bff63e
Add, Remove and Refresh package catalog operations with error handling
Madhusudhan-MSFT Oct 18, 2024
9f3fad3
Add PackageCatalogInterop class for E2E PackageCatalog test operations
Madhusudhan-MSFT Oct 18, 2024
8a39538
Merge branch 'microsoft:master' into user/masudars/WinGet_Source_COM_API
Madhusudhan-MSFT Oct 18, 2024
3853876
Merge branch 'user/masudars/WinGet_Source_COM_API' of https://github.…
Madhusudhan-MSFT Oct 18, 2024
7714865
Refactor status handling for Add, Remove and Refresh with a Template …
Madhusudhan-MSFT Oct 18, 2024
a0a91ba
Align RepairOptions struct with its UUID attribute
Madhusudhan-MSFT Oct 18, 2024
75c68a2
Update contract version to 12 in deployment namespaces for WinGet Pac…
Madhusudhan-MSFT Oct 18, 2024
fead163
[SpellCheck_Error] Fix typo in RemovePackageCatalogAsync method comment
Madhusudhan-MSFT Oct 18, 2024
9fef0f8
Improve clarity of RemoveNonExistingPackageCatalog comment
Madhusudhan-MSFT Oct 18, 2024
69462af
Fix for forbidden-pattern error by spellchecking bot.
Madhusudhan-MSFT Oct 18, 2024
016c618
Remove <Natvis> element from vcxproj.filters
Madhusudhan-MSFT Oct 18, 2024
b4db8df
Refactor error handling that includes logging and update test cases
Madhusudhan-MSFT Oct 21, 2024
28b0a12
Extend group policy tests to include package catalog management opera…
Madhusudhan-MSFT Oct 21, 2024
e1902d9
Merge branch 'microsoft:master' into user/masudars/WinGet_Source_COM_API
Madhusudhan-MSFT Oct 21, 2024
127b4c7
Simplify default source type retrieval in PackageManager
Madhusudhan-MSFT Oct 21, 2024
ea785f3
Remove AcceptSourceAgreements property and related logic
Madhusudhan-MSFT Oct 23, 2024
4dcdc2a
[PR Feedback]:Refactor error handling and add admin/system check func…
Madhusudhan-MSFT Oct 23, 2024
f92b947
Fix indentation in RemovePackageCatalogOptions clsid
Madhusudhan-MSFT Oct 23, 2024
10f92be
Refactor argument validation in AddPackageCatalogAsync & RemovePackag…
Madhusudhan-MSFT Oct 23, 2024
1244dd6
[PR Feedback:] Refactor progress reporting mechanism
Madhusudhan-MSFT Oct 24, 2024
2066dbf
[SpellCheck] Fix typo in `OnProgress` method parameter description
Madhusudhan-MSFT Oct 24, 2024
16ecf85
Add validation for progressReporter and improve map insertion
Madhusudhan-MSFT Oct 24, 2024
b5eae14
[PR Feedback] Refactor error handling and optimize data structures
Madhusudhan-MSFT Oct 25, 2024
340200a
Update PackageManager.idl comments for async operations
Madhusudhan-MSFT Oct 25, 2024
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
78 changes: 78 additions & 0 deletions src/AppInstallerCLIE2ETests/Interop/GroupPolicyForInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace AppInstallerCLIE2ETests.Interop
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using AppInstallerCLIE2ETests.Helpers;
using Microsoft.Management.Deployment;
Expand Down Expand Up @@ -51,6 +52,16 @@ public void CleanUp()
GroupPolicyHelper.DeleteExistingPolicies();
}

/// <summary>
/// Test class Tear down.
/// </summary>
[OneTimeTearDown]
public void TestClassTearDown()
{
// Restore the tests source if it was removed as the affects subsequent tests.
TestCommon.SetupTestSource();
}

/// <summary>
/// Validates disabling WinGetPolicy should block COM/WinRT Objects creation (InProcess and OutOfProcess).
/// </summary>
Expand Down Expand Up @@ -91,6 +102,14 @@ public void DisableWinGetPolicy()
Assert.AreEqual(Constants.BlockByWinGetPolicyErrorMessage, groupPolicyException.Message);
Assert.AreEqual(Constants.ErrorCode.ERROR_BLOCKED_BY_POLICY, groupPolicyException.HResult);

groupPolicyException = Assert.Catch<GroupPolicyException>(() => { AddPackageCatalogOptions packageManagerSettings = this.TestFactory.CreateAddPackageCatalogOptions(); });
Assert.AreEqual(Constants.BlockByWinGetPolicyErrorMessage, groupPolicyException.Message);
Assert.AreEqual(Constants.ErrorCode.ERROR_BLOCKED_BY_POLICY, groupPolicyException.HResult);

groupPolicyException = Assert.Catch<GroupPolicyException>(() => { RemovePackageCatalogOptions packageManagerSettings = this.TestFactory.CreateRemovePackageCatalogOptions(); });
Assert.AreEqual(Constants.BlockByWinGetPolicyErrorMessage, groupPolicyException.Message);
Assert.AreEqual(Constants.ErrorCode.ERROR_BLOCKED_BY_POLICY, groupPolicyException.HResult);

// PackageManagerSettings is not implemented in context OutOfProcDev
if (this.TestFactory.Context == ClsidContext.InProc)
{
Expand Down Expand Up @@ -159,6 +178,65 @@ public async Task DisableWinGetCommandLineInterfacesPolicy()
var packageVersion = "2.0.0.0";
string downloadDir = Path.Combine(TestCommon.GetDefaultDownloadDirectory(), $"{Constants.ModifyRepairInstaller}_{packageVersion}");
TestCommon.AssertInstallerDownload(downloadDir, "TestModifyRepair", packageVersion, ProcessorArchitecture.X86, TestCommon.Scope.Unknown, PackageInstallerType.Burn, "en-US");

// Add, update and remove package catalog
await this.AddUpdateRemovePackageCatalog();
}

private async Task AddUpdateRemovePackageCatalog()
{
// Remove the tests source if it exists.
await this.RemovePackageCatalog();

PackageManager packageManager = this.TestFactory.CreatePackageManager();

// Add package catalog
AddPackageCatalogOptions options = this.TestFactory.CreateAddPackageCatalogOptions();
options.SourceUri = Constants.TestSourceUrl;
options.Name = Constants.TestSourceName;
options.TrustLevel = PackageCatalogTrustLevel.Trusted;

var addCatalogResult = await packageManager.AddPackageCatalogAsync(options);
Assert.IsNotNull(addCatalogResult);
Assert.AreEqual(AddPackageCatalogStatus.Ok, addCatalogResult.Status);

// Get package catalog
var packageCatalog = packageManager.GetPackageCatalogByName(options.Name);

Assert.IsNotNull(packageCatalog);
Assert.AreEqual(options.Name, packageCatalog.Info.Name);
Assert.AreEqual(options.SourceUri, packageCatalog.Info.Argument);
var lastUpdatedTime = packageCatalog.Info.LastUpdateTime;

// Update package catalog
// Sleep for 30 seconds to make sure the last updated time is different after the refresh.
Thread.Sleep(TimeSpan.FromSeconds(30));

var updateResult = await packageCatalog.RefreshPackageCatalogAsync();
Assert.IsNotNull(updateResult);
Assert.AreEqual(RefreshPackageCatalogStatus.Ok, updateResult.Status);

packageCatalog = packageManager.GetPackageCatalogByName(options.Name);
Assert.IsTrue(packageCatalog.Info.LastUpdateTime > lastUpdatedTime);

// Remove package catalog
await this.RemovePackageCatalog();
}

private async Task RemovePackageCatalog()
{
PackageManager packageManager = this.TestFactory.CreatePackageManager();

// Remove the tests source if it exists.
RemovePackageCatalogOptions removePackageCatalogOptions = this.TestFactory.CreateRemovePackageCatalogOptions();
removePackageCatalogOptions.Name = Constants.TestSourceName;

var removeCatalogResult = await packageManager.RemovePackageCatalogAsync(removePackageCatalogOptions);
Assert.IsNotNull(removeCatalogResult);
Assert.AreEqual(RemovePackageCatalogStatus.Ok, removeCatalogResult.Status);

var packageCatalog = packageManager.GetPackageCatalogByName(removePackageCatalogOptions.Name);
Assert.IsNull(packageCatalog);
}
}
}
Loading
Loading