示例#1
0
        private void RunTestsForGivenServerVersion(List <XenServerVersion> xenServerVersions,
                                                   List <XenServerPatch> xenServerPatches,
                                                   List <XenCenterVersion> xenCenterVersions)
        {
            CheckProvidedVersionNumber(xenServerVersions);

            Status = String.Format("Generating server {0} mock-ups...", ServerVersion);
            SetupMocks(xenServerPatches, xenServerVersions);

            Status = "Determining XenCenter update required...";
            var xcupdateAlerts = XenAdmin.Core.Updates.NewXenCenterUpdateAlerts(xenCenterVersions, new Version(ServerVersion));

            Status = "Determining XenServer update required...";
            var updateAlerts = XenAdmin.Core.Updates.NewXenServerVersionAlerts(xenServerVersions).Where(alert => !alert.CanIgnore).ToList();

            HfxEligibilityValidator hfxEligibilityValidator = new HfxEligibilityValidator(xenServerVersions);

            Status = "Running hotfix eligibility check...";
            RunHfxEligibilityValidator(hfxEligibilityValidator);

            Status = "Determining patches required...";
            var patchAlerts = XenAdmin.Core.Updates.NewXenServerPatchAlerts(xenServerVersions, xenServerPatches).Where(alert => !alert.CanIgnore).ToList();

            //Build patch checks list
            List <AlertFeatureValidator> validators = new List <AlertFeatureValidator>
            {
                new CorePatchDetailsValidator(patchAlerts),
                new PatchURLValidator(patchAlerts),
                new ZipContentsValidator(patchAlerts)
            };

            Status = "Running patch check(s), this may take some time...";
            RunValidators(validators);

            Status = "Generating summary...";
            GeneratePatchSummary(patchAlerts, validators, hfxEligibilityValidator, updateAlerts, xcupdateAlerts);
        }
 public HfxEligibilityValidatorDecorator(OuputComponent ouputComponent, HfxEligibilityValidator validator, string header)
 {
     SetComponent(ouputComponent);
     this.validator = validator;
     this.header    = header;
 }
示例#3
0
        private void GeneratePatchSummary(List <XenServerPatchAlert> alerts, List <AlertFeatureValidator> validators, HfxEligibilityValidator hfxEligibilityValidator,
                                          List <XenServerVersionAlert> updateAlerts, List <XenCenterUpdateAlert> xcupdateAlerts)
        {
            OuputComponent                   oc            = new OutputTextOuputComponent(XmlLocation, ServerVersion);
            XenCenterUpdateDecorator         xcud          = new XenCenterUpdateDecorator(oc, xcupdateAlerts);
            XenServerUpdateDecorator         xsud          = new XenServerUpdateDecorator(xcud, updateAlerts);
            HfxEligibilityValidatorDecorator hevd          = new HfxEligibilityValidatorDecorator(xsud, hfxEligibilityValidator, "Hotfix eligibility check:");
            PatchAlertDecorator              pad           = new PatchAlertDecorator(hevd, alerts);
            AlertFeatureValidatorDecorator   afdCoreFields = new AlertFeatureValidatorDecorator(pad,
                                                                                                validators.First(v => v is CorePatchDetailsValidator),
                                                                                                "Core fields in patch checks:");
            AlertFeatureValidatorDecorator afdPatchUrl = new AlertFeatureValidatorDecorator(afdCoreFields,
                                                                                            validators.First(v => v is PatchURLValidator),
                                                                                            "Required patch URL checks:");
            AlertFeatureValidatorDecorator afdZipContents = new AlertFeatureValidatorDecorator(afdPatchUrl,
                                                                                               validators.First(v => v is ZipContentsValidator),
                                                                                               "Required patch zip content checks:");

            if (CheckHotfixContents)
            {
                Output = afdZipContents.Generate().Insert(0, Output).ToString();
            }
            else
            {
                Output = afdPatchUrl.Generate().Insert(0, Output).ToString();
            }
        }
示例#4
0
 private void RunHfxEligibilityValidator(HfxEligibilityValidator validator)
 {
     validator.Validate();
     Status = "Hotfix Eligibility Validator check complete";
 }