Example #1
0
        public void PackagePayloads()
        {
            string sourceFile      = Path.Combine(PackageTests.TestDataDirectory, @"PackagePayloads\Product.wxs");
            string outputDirectory = this.TestDirectory;
            string PayloadFile1    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile1.txt");
            string PayloadFile2    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile2.txt");
            string PayloadFile3    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile3.txt");
            string PayloadFile4    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile4.txt");
            string PayloadFile5    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile5.txt");

            // build the bootstrapper
            string bootstrapper = Builder.BuildBundlePackage(outputDirectory, sourceFile);

            // verify the burnManifest has the correct information
            PackageTests.VerifyMsiPackageInformation(outputDirectory, "MsiPackage1.msi", "MsiPackage1", null, BundleTests.MsiPackageProductCode, false, false, string.Format("{0}v0.1.0.0", BundleTests.MsiPackageProductCode), null, BundleTests.MsiPackageFile);
            PackageTests.VerifyMsuPackageInformation(outputDirectory, "MsuPackage2.msu", "MsuPackage2", null, false, false, null, BundleTests.MsuPackageFile);
            PackageTests.VerifyMspPackageInformation(outputDirectory, "MspPackage3.msp", "MspPackage3", null, BundleTests.MspPackagePatchCode, false, false, BundleTests.MspPackagePatchCode, null, BundleTests.MspPackageFile);
            PackageTests.VerifyExePackageInformation(outputDirectory, "ExePackage4.exe", "ExePackage4", null, false, false, string.Empty, string.Empty, string.Empty, @"file://wixbuild/releases/wix/", BundleTests.ExePackageFile);

            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage1.msi", "MsiPackage1", "PayloadFile1.txt", null, PayloadFile1);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSU, "MsuPackage2.msu", "MsuPackage2", "PayloadFile2.txt", null, PayloadFile2);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSP, "MspPackage3.msp", "MspPackage3", "PayloadFile3.txt", null, PayloadFile3);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSP, "MspPackage3.msp", "MspPackage3", "PayloadFile4.txt", "http://go.microsoft.com/fwlink/?linkid=164202", PayloadFile4);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.EXE, "ExePackage4.exe", "ExePackage4", "PayloadFile5.txt", null, PayloadFile5);
        }
        public void ChainPackageGroupRefChild()
        {
            string sourceFile      = Path.Combine(ChainTests.TestDataDirectory, @"ChainPackageGroupRefChild\Product.wxs");
            string outputDirectory = this.TestDirectory;

            // build the bootstrapper
            string bootstrapper = Builder.BuildBundlePackage(outputDirectory, sourceFile);

            // verify the ParameterInfo and burnManifest has the correct information
            PackageTests.VerifyMsiPackageInformation(outputDirectory, "MsiPackage.msi", "MsiPackage", null, BundleTests.MsiPackageProductCode, false, false, string.Format("{0}v0.1.0.0", BundleTests.MsiPackageProductCode), null, BundleTests.MsiPackageFile);
            PackageTests.VerifyMspPackageInformation(outputDirectory, "MspPackage.msp", "MspPackage", null, BundleTests.MspPackagePatchCode, false, false, BundleTests.MspPackagePatchCode, null, BundleTests.MspPackageFile);
            PackageTests.VerifyMsuPackageInformation(outputDirectory, "MsuPackage.msu", "MsuPackage", null, false, false, null, BundleTests.MsuPackageFile);
            PackageTests.VerifyExePackageInformation(outputDirectory, "ExePackage.exe", "ExePackage", null, false, false, string.Empty, string.Empty, string.Empty, null, BundleTests.ExePackageFile);
        }
Example #3
0
        public void ValidMsiProperty()
        {
            string sourceFile      = Path.Combine(PackageTests.TestDataDirectory, @"ValidMsiProperty\Product.wxs");
            string outputDirectory = this.TestDirectory;

            // build the bootstrapper
            string bootstrapper = Builder.BuildBundlePackage(outputDirectory, sourceFile);

            // verify the burnManifest has the correct information
            PackageTests.VerifyMsiPropertyInformation(outputDirectory, "MsiPackage1", "MsiProperty1", "x!=y | z==y");
            PackageTests.VerifyMsiPropertyInformation(outputDirectory, "MsiPackage1", "MsiProperty2", "http://www.microsoft.com");
            PackageTests.VerifyMsiPropertyInformation(outputDirectory, "MsiPackage1", "MsiProperty3", "23.00");
            PackageTests.VerifyMsiPropertyInformation(outputDirectory, "MsiPackage2", "MsiProperty1", "x!=y | z==y");
        }
Example #4
0
        // bug# https://sourceforge.net/tracker/?func=detail&aid=2980325&group_id=105970&atid=642714
        public void ValidPackage()
        {
            string sourceFile      = Path.Combine(PackageTests.TestDataDirectory, @"ValidPackage\Product.wxs");
            string outputDirectory = this.TestDirectory;

            // build the bootstrapper
            string bootstrapper = Builder.BuildBundlePackage(outputDirectory, sourceFile);

            // verify the burnManifest has the correct information
            PackageTests.VerifyMspPackageInformation(outputDirectory, "MspPackage1.msp", "MspPackage1", null, BundleTests.MspPackagePatchCode, true, false, "MspPackage1CacheId", null, BundleTests.MspPackageFile);
            PackageTests.VerifyMsuPackageInformation(outputDirectory, "MsuPackage2.msu", "MsuPackage2", null, true, true, @"ftp://192.168.0.1/testPayload.exe", BundleTests.MsuPackageFile);
            PackageTests.VerifyMsiPackageInformation(outputDirectory, "MsiPackage3.msi", "MsiPackage3", null, BundleTests.MsiPackageProductCode, false, true, string.Format("{0}v0.1.0.0", BundleTests.MsiPackageProductCode), @"http://go.microsoft.com/fwlink/?linkid=164202", BundleTests.MsiPackageFile);
            PackageTests.VerifyExePackageInformation(outputDirectory, "ExePackage5.exe", "ExePackage5", "x!=y", true, true, @"\q", @"\q \r \t", @"\anotherargument -t", @"\\wixbuild\releases\wix\", BundleTests.MsiPackageFile); // using the msi package for an exe

            PackageTests.VerifyMsiPackageOrder(outputDirectory, "ExePackage5.exe", "MspPackage1.msp", "MsuPackage2.msi", "MsiPackage3.msi");
        }
Example #5
0
        public void ValidPayloadDownloadURL()
        {
            string sourceFile      = Path.Combine(PayloadTests.TestDataDirectory, @"ValidPayloadDownloadURL\Product.wxs");
            string PayloadFile1    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile1.txt");
            string PayloadFile2    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile2.txt");
            string PayloadFile3    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile3.txt");
            string PayloadFile4    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile4.txt");
            string outputDirectory = this.TestContext.TestDirectory;

            // build the bootstrapper
            string bootstrapper = Builder.BuildBundlePackage(outputDirectory, sourceFile);

            // verify the ParameterInfo and burnManifest has the correct information
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile1.txt", @"http://go.microsoft.com/fwlink/?linkid=164202", PayloadFile1);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile2.txt", @"http://localhost/testPayload", PayloadFile2);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile3.txt", @"ftp://192.168.0.1/testPayload.exe", PayloadFile3);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile4.txt", @"file://wixbuild/releases/wix/", PayloadFile4);
        }
Example #6
0
        /// <summary>
        /// Verify the pacakge Payload information in Burn_Manifest.xml
        /// </summary>
        /// <param name="embededResourcesDirectoryPath">Output folder where all the embeded resources are.</param>
        /// <param name="expectedParentPackageType">Parent Package type.</param>
        /// <param name="expectedParentPackageName">Parent Package name; this is the attribute used to locate the package.</param>
        /// <param name="expectedFileName">Payload name; this is the attribute used to locate the payload.</param>
        /// <param name="expectedDownloadURL">@DownloadURL expected value.</param>
        /// <param name="acctualFilePath">Path to the acctual file to compate against file in cab.</param>
        public static void VerifyPackagePayloadInformation(string embededResourcesDirectoryPath, PackageTests.PackageType expectedParentPackageType, string expectedParentPackageName,string expectedParentPackageId, string expectedFileName, string expectedDownloadURL, string acctualFilePath)
        {
            string expectedFileSize = new FileInfo(acctualFilePath).Length.ToString();
            string expectedHash = FileVerifier.ComputeFileSHA1Hash(acctualFilePath);

            // find the Payload element
            string payloadXPath = string.Format(@"//burn:Payload[@FilePath='{0}']", expectedFileName);
            XmlNodeList payloadNodes = BundleTests.QueryBurnManifest(embededResourcesDirectoryPath, payloadXPath);
            Assert.True(1 == payloadNodes.Count, String.Format("No Package payload with the name: '{0}' was found in Burn_Manifest.xml.", expectedFileName));
            BundleTests.VerifyAttributeValue(payloadNodes[0], "FileSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(payloadNodes[0], "Sha1Hash", expectedHash);
            BundleTests.VerifyAttributeValue(payloadNodes[0], "DownloadUrl", expectedDownloadURL);

            // make sure the payload is added to the package
            string payloadId = payloadNodes[0].Attributes["Id"].Value;
            string packagePayloadRefXPath = string.Format(@"//burn:{0}[@Id='{1}']/burn:PayloadRef[@Id='{2}']", GetPackageElementName(expectedParentPackageType), expectedParentPackageId, payloadId);
            XmlNodeList packagePayloadRefNodes = BundleTests.QueryBurnManifest(embededResourcesDirectoryPath, packagePayloadRefXPath);
            Assert.True(1 == packagePayloadRefNodes.Count, String.Format("Package payload with the name: '{0}' was found under Package '{1}'.", expectedFileName, expectedParentPackageId));

            // verify the correct file is added to the attached container
            if (null == expectedDownloadURL)
            {
                string extractedFilePath = Path.Combine(Builder.AttachedContainerFolderName, expectedFileName);
                FileVerifier.VerifyFilesAreIdentical(acctualFilePath, extractedFilePath);
            }
        }
Example #7
0
        /// <summary>
        /// Verifies Package information in Burn-Manifest.xml and Burn-UxManifest.xml.
        /// </summary>
        /// <param name="embededResourcesDirectoryPath">Output folder where all the embeded resources are.</param>
        /// <param name="expectedPackageName">Package name; this is the attribute used to locate the package.</param>
        /// <param name="expectedPackageType">Package type MSI, MSP, MSU or EXE.</param>
        /// <param name="expectedId">Expected Package @Id value.</param>
        /// <param name="expectedInstallCondition">Expected Package @InstallCondition value.</param>
        /// <param name="expectedProductCode">Expected Package @ProductCode value.</param>
        /// <param name="expecteVital">Package is viatal or not.</param>
        /// <param name="expectedPermanent">Expected Package @Permanent value.</param>
        /// <param name="expectedCacheId">Expected Package @CacheId value.</param>
        /// <param name="expectedInstallCommmand">Expected @InstallCommand value.</param>
        /// <param name="expectedUninstallCommmand">Expected @UninstallCommand value.</param>
        /// <param name="expectedRepairCommand">Expected @RepairCommand value.</param>
        /// <param name="expectedDownloadURL">Expected Package @DownloadURL value.</param>
        /// <param name="acctualFilePath">Path to the acctual file for comparison.</param>
        private static void VerifyPackageInformation(string embededResourcesDirectoryPath, string expectedPackageName, PackageType expectedPackageType, string expectedId,
                                                     string expectedInstallCondition, string expectedProductCode, bool expecteVital, bool expectedPermanent, string expectedCacheId,
                                                     string expectedInstallCommmand, string expectedUninstallCommmand, string expectedRepairCommand, string expectedDownloadURL,
                                                     string acctualFilePath)
        {
            string expectedFileSize    = new FileInfo(acctualFilePath).Length.ToString();
            string expectedHash        = FileVerifier.ComputeFileSHA1Hash(acctualFilePath);
            string expectedProductSize = expectedFileSize;

            // verify the Burn_Manifest has the correct information
            string      burnManifestXPath = string.Format(@"//burn:{0}[@Id='{1}']", GetPackageElementName(expectedPackageType), expectedId);
            XmlNodeList burnManifestNodes = BundleTests.QueryBurnManifest(embededResourcesDirectoryPath, burnManifestXPath);

            Assert.AreEqual(1, burnManifestNodes.Count, "No MsiPackage with the Id: '{0}' was found in Burn_Manifest.xml.", expectedId);
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "InstallCondition", expectedInstallCondition);
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "Permanent", expectedPermanent ? "yes" : "no");
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "Vital", expecteVital ? "yes" : "no");

            if (expectedPackageType == PackageType.MSI)
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "ProductCode", expectedProductCode);
            }

            if (expectedPackageType == PackageType.EXE)
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "InstallArguments", expectedInstallCommmand);
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "UninstallArguments", expectedUninstallCommmand);
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "RepairArguments", expectedRepairCommand);
            }

            if (!String.IsNullOrEmpty(expectedCacheId))
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "CacheId", expectedCacheId);
            }

            // verify payload information
            PackageTests.VerifyPackagePayloadInformation(embededResourcesDirectoryPath, expectedPackageType, expectedPackageName, expectedId, expectedPackageName, expectedDownloadURL, acctualFilePath);

            // verify the Burn-UxManifest has the correct information
            string expectedProductName = null;
            string expectedDiscription = null;

            if (expectedPackageType == PackageType.EXE)
            {
                FileVersionInfo fileInfo = FileVersionInfo.GetVersionInfo(acctualFilePath);
                expectedProductName = string.IsNullOrEmpty(fileInfo.ProductName) ? null : fileInfo.ProductName;
                expectedDiscription = string.IsNullOrEmpty(fileInfo.FileDescription) ? null : fileInfo.FileDescription;
            }
            else if (expectedPackageType == PackageType.MSI)
            {
                string subject = Verifier.GetMsiSummaryInformationProperty(acctualFilePath, Verifier.MsiSummaryInformationProperty.Subject);
                expectedProductName = string.IsNullOrEmpty(subject) ? null : subject;
            }

            string      burnUxManifestXPath = string.Format(@"//burnUx:WixPackageProperties[@Package='{0}']", expectedId);
            XmlNodeList burnUxManifestNodes = BundleTests.QueryBurnUxManifest(embededResourcesDirectoryPath, burnUxManifestXPath);

            Assert.AreEqual(1, burnUxManifestNodes.Count, "No WixPackageProperties for Package: '{0}' was found in Burn-UxManifest.xml.", expectedId);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "Vital", expecteVital ? "yes" : "no");
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "DownloadSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "PackageSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "InstalledSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "DisplayName", expectedProductName);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "Description", expectedDiscription);
        }