Beispiel #1
0
        public void SilentInstallerTest(MSIInstaller installer)
        {
            string actualProductName = installer.ProductName.Replace("-oss", "");

            // Install
            TestContext.Out.WriteLine($"Installing {actualProductName}...");
            int installExitCode = installer.Install().ExitCode;

            TestContext.Out.WriteLine($" -> installation finished with exit code {installExitCode}");
            Assert.That(installExitCode, Is.EqualTo(0), "Product installed successfully (exit code 0)");

            // TODO Enable immutable dir check once stack version value is determined
            //string immutablePath = Path.Combine(pathsProvider.ElasticImmutableRoot, "Beats", stackVersion, actualProductName);
            //TestContext.Out.WriteLine($" -> checking immutable path exists: {immutablePath}");
            //DirectoryAssert.Exists(immutablePath, $"Immutable path {immutablePath} exists after installation");

            try
            {
                foreach (string mutableDir in installer.ProductConfig.MutableDirs)
                {
                    string mutablePath = Path.Combine(pathsProvider.ElasticMutableRoot, "Beats", actualProductName, mutableDir);
                    TestContext.Out.WriteLine($" -> checking mutable path exists: {mutablePath}");
                    DirectoryAssert.Exists(mutablePath, $"Mutable path {mutablePath} exists after installation");
                }

                ServiceController service = ServiceController.GetServices().FirstOrDefault(service => service.ServiceName == actualProductName);
                TestContext.Out.WriteLine($" -> checking service '{actualProductName}' exists");
                Assert.That(service, Is.Not.Null, $"Service named '{actualProductName}' exists");
            }
            finally
            {
                // Uninstall
                TestContext.Out.WriteLine($"Uninstalling {actualProductName}...");
                int uninstallExitCode = installer.Uninstall().ExitCode;

                TestContext.Out.WriteLine($" -> uninstall finished with exit code {uninstallExitCode}.");
                Assert.That(uninstallExitCode, Is.EqualTo(0), "Product uninstalled successfully (exit code 0)");

                // TODO Enable immutable dir check once stack version value is determined
                //TestContext.Out.WriteLine($" -> checking immutable path no longer exists: {immutablePath}");
                //DirectoryAssert.Exists(immutablePath, $"Immutable path {immutablePath} no longer exists after uninstall");

                foreach (string mutableDir in installer.ProductConfig.MutableDirs)
                {
                    string mutablePath = Path.Combine(pathsProvider.ElasticMutableRoot, "Beats", actualProductName, mutableDir);
                    TestContext.Out.WriteLine($" -> checking mutable path no longer exists: {mutablePath}");
                    DirectoryAssert.DoesNotExist(mutablePath, $"Mutable path {mutablePath} no longer exists after uninstall");
                }

                ServiceController service = ServiceController.GetServices().FirstOrDefault(service => service.ServiceName == actualProductName);
                TestContext.Out.WriteLine($" -> checking service '{actualProductName}' no longer exists");
                Assert.That(service, Is.Null, $"Service named '{actualProductName}' no longer exists");
            }

            TestContext.Out.WriteLine($"[PASSED] {installer.ProductName} MSI silent install/uninstall");
        }
Beispiel #2
0
        static IEnumerable Installers()
        {
            foreach (string productName in BuildConfig.ProductNames)
            {
                ProductConfig        productConfig  = BuildConfig.Products[productName];
                IEnumerable <string> installerPaths = Directory
                                                      .EnumerateFiles(pathsProvider.OutDir, $"{productName}-*.msi", SearchOption.AllDirectories)
                                                      .Where(filename => new Regex(@$ "{productName}-\d.*\.msi").IsMatch(filename));

                foreach (string installerPath in installerPaths)
                {
                    MSIInstaller installer = new MSIInstaller(productName, productConfig, installerPath, pathsProvider.TestLogsDir);

                    TestCaseData td = new TestCaseData(installer);
                    td.SetName($"{productName} ({installerPath})");

                    yield return(td);
                }
            }
        }
Beispiel #3
0
        void TextEditor_Drop(object sender, DragEventArgs e)
        {
            Point pos = e.GetPosition(sender as IInputElement);

            System.Windows.DataObject o = e.Data as System.Windows.DataObject;
            string[] formats            = o.GetFormats();
            string   SAMPLE_FORMAT      = "DXUnionPacket.ViewModel.Sample";
            string   MSI_INSTALL_FORMAT = "DXInstaller.MSIInstaller";
            string   GONG_DD_FORMAT     = "GongSolutions.Wpf.DragDrop.DropInfo";
            string   text = "";

            foreach (string format in formats)
            {
                if (format.Equals(SAMPLE_FORMAT))
                {
                    if (o.GetDataPresent(SAMPLE_FORMAT))
                    {
                        lock (sync){
                            Object oo = o.GetData(SAMPLE_FORMAT);
                            Sample s  = o.GetData(SAMPLE_FORMAT, true) as Sample;
                            text = s.Text;
                            break;
                        }
                    }
                }
                if (format.Equals(MSI_INSTALL_FORMAT))
                {
                    MSIInstaller i = o.GetData(MSI_INSTALL_FORMAT) as MSIInstaller;
                    text = i.Guid;
                    break;
                }
            }
            if (!String.IsNullOrEmpty(text))
            {
                InsertText(text, pos);
            }
        }
        public static void Install()
        {
            _logger.Info("Detected install command line. Selected 'Install' as deployment");
            if (EnvironmentVariables.Configuration.InstallSettings == null)
            {
                _logger.Trace("No installation arguments specified in settings.xml. Looking for install.xml");
                var installXmlPath = Path.Combine(DeploymentEnvironmentVariables.RootDirectory, "install.xml");
                if (!File.Exists(installXmlPath))
                {
                    ExitInstallation("install.xml is missing", ExitCode.InstallFileMissing);
                }

                _logger.Trace("Found install.xml. Reading...");
                EnvironmentVariables.InstallSettings = ReadXml <InstallSettings>(installXmlPath);
                _logger.Trace("Successfully read install.xml");
            }
            else
            {
                _logger.Trace("Install options specified inside settings.xml");
                EnvironmentVariables.InstallSettings = EnvironmentVariables.Configuration.InstallSettings;
            }

            _logger.Info("Read install settings. Starting installation...");
            _logger.Trace("Checking CommandLine Path...");

            EnvironmentVariables.InstallSettings.CommandLine = VerifyCommandLine(EnvironmentVariables.InstallSettings.CommandLine);

            _logger.Trace("Verifiying that file specified in CommandLine exists...");
            // CommandLine should either specify an exe file or an msi file. Either way the file has to exist
            if (!File.Exists(EnvironmentVariables.InstallSettings.CommandLine))
            {
                ExitInstallation($"File specified in CommandLine does not exists ({EnvironmentVariables.InstallSettings.CommandLine}). Aborting installation", ExitCode.InvalidCommandLineSpecified);
            }

            // Detecting installation type
            try
            {
                var sequence = default(IInstallUninstallSequence);
                if (EnvironmentVariables.InstallSettings.CommandLine.ToLower().EndsWith(".msi"))
                {
                    // Microsoft Installer
                    sequence = new MSIInstaller(EnvironmentVariables.InstallSettings);
                }
                else
                {
                    // Unknwon / EXE installer
                    sequence = new ExeInstaller(EnvironmentVariables.InstallSettings);
                }

                _mainSequence = new MainSequence(sequence);
                _mainSequence.OnSequenceCompleted += OnSequenceCompleted;
                _mainSequence.SequenceBegin();

                do
                {
                    Thread.Sleep(1000);
                }while (!_sequenceCompleted);
            }
            catch (Exception ex)
            {
                ExitInstallation(ex, "Error during installation", ExitCode.ErrorDuringInstallation);
            }

            _logger.Info("Install sequence completed");
        }