-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic test for Msmq install/uninstall.
Fix up lack of WIX CUSTOM_ACTION_DECORATION wrappers Add new RuntimeTest skipper for Server Features / Optional Features. Signed-off-by: Bevan Weiss <[email protected]>
- Loading branch information
1 parent
733886e
commit b4cb6f1
Showing
8 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,5 @@ | |
#include "mqqueuesched.h" | ||
#include "mqutilexec.h" | ||
#include "mqqueueexec.h" | ||
|
||
#include "..\..\caDecor.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/test/burn/WixTestTools/RuntimePrereqFeatureFactAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
|
||
namespace WixTestTools | ||
{ | ||
using System; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Management; | ||
using System.Collections.Generic; | ||
using System.Security.Principal; | ||
using WixInternal.TestSupport.XunitExtensions; | ||
|
||
public class RuntimePrereqFeatureFactAttribute : RuntimeFactAttribute | ||
{ | ||
public static HashSet<string> OptionalFeatures = new(StringComparer.OrdinalIgnoreCase); | ||
public static HashSet<string> ServerFeatures = new(StringComparer.OrdinalIgnoreCase); | ||
static RuntimePrereqFeatureFactAttribute() | ||
{ | ||
AddFeaturesToSet(ServerFeatures, "Win32_ServerFeature"); | ||
AddFeaturesToSet(OptionalFeatures, "Win32_OptionalFeature"); | ||
} | ||
|
||
private static void AddFeaturesToSet(HashSet<string> featureSet, string featureSetName) | ||
{ | ||
try | ||
{ | ||
var objMC = new ManagementClass(featureSetName); | ||
var objMOC = objMC?.GetInstances(); | ||
if (objMOC is not null) | ||
{ | ||
foreach (var objMO in objMOC) | ||
{ | ||
string featureName = (string)objMO.Properties["Name"].Value; | ||
if ((uint)objMO.Properties["InstallState"].Value == 1) | ||
{ | ||
featureSet.Add(featureName); | ||
} | ||
} | ||
} | ||
} | ||
catch | ||
{ | ||
} | ||
} | ||
|
||
public RuntimePrereqFeatureFactAttribute(params string[] prerequisiteFeatures) : base() | ||
{ | ||
var missingRequirements = prerequisiteFeatures.Select(x => x).Where(x => !ServerFeatures.Contains(x) && !OptionalFeatures.Contains(x)); | ||
|
||
if (missingRequirements.Any()) | ||
{ | ||
this.Skip = "This test is missing the following Feature pre-requisites: " + String.Join(", ", missingRequirements); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/test/msi/TestData/MsmqExtensionTests/MsmqInstall/MsmqInstall.wixproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
<Project Sdk="WixToolset.Sdk"> | ||
<PropertyGroup> | ||
<UpgradeCode>{A75B81F4-3335-4B4D-B766-303E136ED374}</UpgradeCode> | ||
<ProductComponentsRef>true</ProductComponentsRef> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="..\..\Templates\Product.wxs" Link="Product.wxs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="WixToolset.Msmq.wixext" /> | ||
</ItemGroup> | ||
</Project> |
17 changes: 17 additions & 0 deletions
17
src/test/msi/TestData/MsmqExtensionTests/MsmqInstall/product.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
|
||
|
||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:msmq="http://wixtoolset.org/schemas/v4/wxs/msmq"> | ||
<Fragment> | ||
<ComponentGroup Id="ProductComponents"> | ||
<ComponentRef Id="Component1" /> | ||
</ComponentGroup> | ||
</Fragment> | ||
|
||
<Fragment> | ||
<Component Id="Component1"> | ||
<File Source="$(sys.SOURCEFILEPATH)" KeyPath="yes" /> | ||
<msmq:MessageQueue Id="ExampleQueue" PathName=".\private$\example-queue" Label="Example Queue" Transactional="yes" /> | ||
</Component> | ||
</Fragment> | ||
</Wix> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
|
||
namespace WixToolsetTest.MsiE2E | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using WixTestTools; | ||
using Xunit.Abstractions; | ||
|
||
public class MsmqExtensionTests : MsiE2ETests | ||
{ | ||
public MsmqExtensionTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) | ||
{ | ||
} | ||
|
||
[RuntimePrereqFeatureFact("MSMQ-Container", "MSMQ-Server")] | ||
public void CanInstallAndUninstallMsmq() | ||
{ | ||
var product = this.CreatePackageInstaller("MsmqInstall"); | ||
product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
} | ||
} | ||
} |