public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));
            Assert.ArgumentNotNull(output, nameof(output));

            var errorsDetected = false;

            //if (CheckFiles(data, output))
            //{
            //  errorsDetected = true;
            //}

            if (CheckLinkProvider(data, output))
            {
                errorsDetected = true;
            }

            if (CheckPhysicalFolder(data, output))
            {
                errorsDetected = true;
            }

            if (!errorsDetected)
            {
                output.Debug($"For more troubleshooting steps in case of Page Not Found errors in links from ECM messages please refer to the article: {Link}");
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var logs = data.Logs.GetSitecoreLogEntries(LogLevel.All);

            var condition1 = false;
            var condition2 = false;

            const string Exception = "The timeout period elapsed prior to obtaining a connection from the pool.";
            const string Info      = "Starting: Rebuild Suggested Tests Index";

            foreach (var log in logs)
            {
                var ex = log.RawText;
                if (!condition1 && ex.Contains(Exception))
                {
                    condition1 = true;
                }

                if (!condition2 && ex.Contains(Info))
                {
                    condition2 = true;
                }

                if (condition1 && condition2)
                {
                    Report(output);

                    return;
                }
            }
        }
示例#3
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var configuration    = data.SitecoreInfo.Configuration;
            var frequencyElement = configuration.SelectSingleNode("/configuration/sitecore/scheduling/frequency") as XmlElement;
            var text             = frequencyElement?.InnerText;

            if (string.IsNullOrEmpty(text))
            {
                // default 00:01:00 frequency is used
                return;
            }

            TimeSpan frequency;

            if (!TimeSpan.TryParse(text, out frequency))
            {
                output.Warning(WrongFrequencyMessage);

                // default 00:01:00 frequency is used
                return;
            }

            if (frequency.Ticks == 0)
            {
                output.Warning(GetSchedulingStoppedMessage(frequencyElement));
            }
            else if (frequency.Hours >= 1)
            {
                output.Warning(GetShedulingRareMessage(frequencyElement));
            }
        }
示例#4
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.IsNotNull(data, "context");

            var pipeline = data.SitecoreInfo.GetPipeline("pipelines/initializeTracker");

            Assert.IsNotNull(pipeline);

            var version = data.SitecoreInfo.SitecoreVersion;
            var ver     = version.MajorMinorUpdateInt;

            if (ver < 720)
            {
                var supportProcessor = TypeRef.Parse("Sitecore.Support.Analytics.Pipelines.InitializeTracker.Robots", AssemblyRef.Parse("Sitecore.Support.387512"));
                if (pipeline.Processors.All(x => x.Type != supportProcessor))
                {
                    Report(output);
                }
            }
            else if (false ||
                     ver >= 720 && ver < 725 ||
                     ver >= 750 && ver <= 752 ||
                     ver >= 800 && ver < 806 ||
                     ver >= 810 && ver < 817
                     )
            {
                var supportProcessor = TypeRef.Parse("Sitecore.Support.Analytics.RobotDetection.Pipelines.InitializeTracker.Robots", AssemblyRef.Parse("Sitecore.Support.414299"));
                if (pipeline.Processors.All(x => x.Type != supportProcessor))
                {
                    Report(output);
                }
            }
        }
示例#5
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var defaultDatabases = data.SitecoreInfo.SitecoreDefaults.SqlDatabases;
            var databases        = data.Databases.Sql.All;

            foreach (var database in databases)
            {
                if (database == null)
                {
                    continue;
                }

                try
                {
                    ProcessDatabase(database, defaultDatabases, data, output);
                }
                catch (ResourceNotAvailableException)
                {
                    throw new DatabaseResourceNotAvailableException();
                }
                catch (Exception ex)
                {
                    var message = $"Unhandled exception happened during processing {database.Name} database. Find details in log file.";

                    output.Debug(ex, message);
                    output.CannotRun(message);
                }
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            foreach (var database in data.Databases.Sql.All)
            {
                var arr = database.Metrics.Tables
                          .SelectMany(t => t.Value.IndexesHealth
                                      .Select(i => new
                {
                    Name  = "Tables." + t.Key + ".Indexes." + i.Value.Name,
                    Value = i.Value.AverageFragmentationInPercent
                }))
                          .Where(x => x.Value > 10)
                          .ToArray();

                if (arr.Length <= 0)
                {
                    continue;
                }

                var indexes = arr.ToArray(x => $"{x.Name} ({(int)x.Value}%)");
                var message = new ShortMessage(
                    new BoldText(database.Name),
                    new Text($" database indexes require defragmentation."),
                    new BulletedList(indexes),
                    new Text("Refer to the 2.1 section in CMS Performance Tuning Guide for details."));

                output.Error(message);
            }
        }
 public override void Process(IInstanceResourceContext data, ITestOutputContext output)
 {
     if (!data.SitecoreInfo.GetBoolSetting("Analytics.AutoDetectBots"))
     {
         output.Warning(ErrorMessage);
     }
 }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var info = data.SitecoreInfo;

            var getContentEditorWarnings = info.GetPipeline("pipelines/getContentEditorWarnings");

            Assert.IsNotNull(getContentEditorWarnings, "getContentEditorWarnings");

            foreach (var processor in getContentEditorWarnings.Processors)
            {
                Assert.IsNotNull(processor, "processor");

                var type = processor.Type;
                if (type.Equals(GetContentEditorWarningsType))
                {
                    return;
                }
            }

            var testingIndexName = data.SitecoreInfo.GetSetting(@"ContentTesting.TestingIndexName");

            if (!info.ContentSearchIndexes.ContainsKey(testingIndexName))
            {
                return;
            }

            var logs = data.Logs.GetSitecoreLogEntries(LogLevel.Error);

            if (logs.Any(log => log.RawText.Contains(@"Cannot parse '(((__smallupdateddate_tdt")))
            {
                Report(output);
            }
        }
        //protected bool CheckFiles([NotNull] ITestResourceContext data, ITestOutputContext output)
        //{
        //  Assert.ArgumentNotNull(data, nameof(data));
        //
        //  // TODO: rework to use data.SitecoreInfo.StaticFiles API
        //  if (!data.SitecoreInfo.Files.Exists(@"sitecore\RedirectUrlPage.aspx"))
        //  {
        //    output.Error(GetMissingRedirectPageMessage(), url: Link);
        //
        //    return false;
        //  }
        //
        //  return true;
        //}

        protected bool CheckLinkProvider([NotNull] IInstanceResourceContext data, [NotNull] ITestOutputContext output)
        {
            var managerXPath        = "/configuration/sitecore/linkManager";
            var configuration       = data.SitecoreInfo.Configuration;
            var defaultProviderName = EcmHelper.GetAttributeValue(configuration, managerXPath, "defaultProvider");

            if (string.IsNullOrEmpty(defaultProviderName))
            {
                return(true);
            }

            var providerXPath = $"/configuration/sitecore/linkManager/providers/add[@name='{defaultProviderName}']";
            var alwaysIncludeServerUrlValue = EcmHelper.GetAttributeValue(configuration, providerXPath, "alwaysIncludeServerUrl");

            bool alwaysIncludeServerUrl;

            if (!bool.TryParse(alwaysIncludeServerUrlValue, out alwaysIncludeServerUrl) || !alwaysIncludeServerUrl)
            {
                return(true);
            }

            Report(output, GetLinkProviderSettingMessage());

            return(false);
        }
示例#10
0
        public override void Process(ISolutionResourceContext data, ITestOutputContext output)
        {
            var map = data

                      // exclude all CD instances - they do not participate in publishing
                      .Where(x => x.Value.ServerRoles.All(z => z != ServerRole.ContentDelivery))

                      // group all publishing instance setting values to set { 'Pub1': ['Cm1', 'Cm2'], 'Pub2': ['BadCm3'], '': ['BadCm4'] }
                      .GroupBy(x => x.Value.SitecoreInfo.GetSetting(PublishingInstanceSetting))
                      .ToMap(x => x.Key, x => x.ToArray(z => z.Key));

            if (map.Count == 0)
            {
                output.Debug("No publishing instance specified");

                return;
            }

            if (map.Count == 1)
            {
                output.Debug($"Publishing instance is consistent: {map.Keys.FirstOrDefault().EmptyToNull() ?? "N/A"}");

                return;
            }

            var message  = GetMessage(map);
            var detailed = GetDetailed(map);

            output.Error(message, detailed: detailed);
        }
        public override void Process(ISolutionResourceContext solution, ITestOutputContext output)
        {
            var rows = new List <TableRow>();

            foreach (var settingName in solution.SitecoreDefaults.GetSettings().Keys)
            {
                var defaultValue = solution.SitecoreDefaults.GetSetting(settingName);

                if (solution.Values.Any(x => x.SitecoreInfo.GetSetting(settingName) != defaultValue))
                {
                    var columns = new List <Pair>();

                    columns.Add(new Pair("Setting", settingName));
                    columns.AddRange(solution.Values.Select(x => new Pair(x.InstanceName, x.SitecoreInfo.GetSetting(settingName))));
                    columns.Add(new Pair("Default Value", defaultValue.EmptyToNull() ?? "[empty]"));

                    rows.Add(new TableRow(columns));
                }
            }

            if (rows.Any())
            {
                output.Debug(new DetailedMessage(new Text("One or several default Sitecore settings were modified:"), new Table(rows.ToArray())));
            }
        }
示例#12
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            var duplicates     = new Map <List <string> >();
            var resultConfig   = data.SitecoreInfo.Configuration;
            var configurations = resultConfig.SelectElements(ContentSearchXPath + "/*").Select(x => x.Name).Distinct().ToArray();

            foreach (var configuration in configurations)
            {
                var configurationElements = resultConfig.SelectElements($"{ContentSearchXPath}/{configuration}");
                if (configurationElements.Length > 1)
                {
                    var list = duplicates.GetOrAdd(configuration, new List <string>());
                    list.AddRange(configurationElements.Select(x => x.ToString(XmlPrintMode.HeaderOnly)));
                }
            }

            if (duplicates.Any())
            {
                var shortMessage = "There are duplicates in ContentSearch configuration nodes that may lead to unpredictable behavior.";
                var detailed     = new DetailedMessage(
                    new Text("The following ContentSearch configurations are duplicated:"),
                    new BulletedList(duplicates.Select(x => new Container(
                                                           new Text(x.Key),
                                                           new BulletedList(x.Value.Select(z => new Code(z)))
                                                           ))),
                    new Text("To resolve, rewise the configuration files and check the difference between defintions."));

                output.Warning(shortMessage, null, detailed);
            }
        }
        public override void Process(ISolutionResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var defaultAssemblies = data.SitecoreDefaults.Assemblies;

            var resultsMap = new Map <Map>();

            foreach (var defaultAssembly in defaultAssemblies.Values)
            {
                if (defaultAssembly == null)
                {
                    continue;
                }

                var fileName = defaultAssembly.FileName;

                // workaround for sspg-49
                if (fileName.Equals("ninject.dll", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                var assemblyMap = new Map();

                var expectedFileVersion = defaultAssembly.FileVersion;
                assemblyMap.Add("Version", expectedFileVersion);

                var good = true;
                foreach (var instance in data.Values)
                {
                    var result = Process(fileName, instance, defaultAssembly);
                    if (string.IsNullOrEmpty(result))
                    {
                        assemblyMap.Add(instance.InstanceName, "OK");
                    }
                    else
                    {
                        assemblyMap.Add(instance.InstanceName, result);
                        good = false;
                    }
                }

                if (!good)
                {
                    resultsMap.Add(fileName, assemblyMap);
                }
            }

            if (resultsMap.Count > 0)
            {
                output.Warning("There is an inconsistency in assembly files",
                               detailed: new DetailedMessage(new Table(resultsMap.ToArray(x =>
                                                                                          new TableRow(
                                                                                              new[] { new Pair("Assembly", x.Key) }
                                                                                              .Concat(x.Value.Select(c => new Pair(c.Key, c.Value)))
                                                                                              .ToArray())))));
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            if (data.SitecoreInfo.GetBoolSetting(SettingName, true))
            {
                Report(output);
            }
        }
示例#15
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            if (data.WebServer.Server.FrameworkVersions.All(p => !FrameworkVersion.v45x.HasFlag(p)))
            {
                output.Error("Sitecore XP requires .NET Framework 4.5.");
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            var logs = data.Logs.GetSitecoreLogEntries(LogLevel.Error);

            if (logs.Any(log => log.RawText.Contains(ErrorText)))
            {
                Report(output);
            }
        }
示例#17
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            if (data.WebServer.Server.OperationSystemBitness != FrameworkBitness.x64)
            {
                output.Warning("The 32-bit Operation System is used, upgrade to 64-bit OS is recommended. Read more in Installation Guide, section Sitecore Hosting Environment Requirements");
            }
        }
示例#18
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            if (data.SitecoreInfo.GetBoolSetting("Caching.DisableCacheSizeLimits"))
            {
                output.Warning("All cache size limits are disabled. It can potentially cause significant performance degradation and OutOfMemoryException exception. It is recommended to disable this setting. Check CMS Performance Tuning Guide document for details.");
            }
        }
        private void Error(IInstanceResourceContext data, ITestOutputContext output, string name)
        {
            var value = data.Databases.ConnectionStrings.TryGetValue(name.ToLower());

            if (value == null)
            {
                output.Error(GetErrorMessage(name));
            }
        }
示例#20
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            if (data.SitecoreInfo.GetSetting("Analytics.DefaultDefinitionDatabase") != "web")
            {
                output.Warning(ErrorMessage);
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            var value = data.SitecoreInfo.GetSetting("Analytics.ClusterName", "default-cd-cluster");

            if (string.IsNullOrWhiteSpace(value) || value == "default-cd-cluster")
            {
                output.Error(new ShortMessage("The Analytics.ClusterName setting is not configured"), new Uri("https://sitecore.stackexchange.com/questions/4970/analytics-clustername-in-a-multi-site-scaled-environment"));
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            var reportingSecondary = data.Databases.Sql.DatabaseNames.Contains(ConnectionString);

            if (reportingSecondary)
            {
                output.Warning(ErrorMessage);
            }
        }
示例#23
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var xdbEnabled = data.SitecoreInfo.IsAnalyticsEnabled;
            var name       = "reporting";
            var reporting  = data.Databases.Sql[name];

            if (reporting == null)
            {
                var message = $"The {name} connection string is not presented in the ConnectionStrings.config file";
                if (xdbEnabled)
                {
                    output.Error(message);
                }
                else
                {
                    output.Debug(message + ", but that's okay since xdb is disabled");
                }

                return;
            }

            var schema = reporting.Schema;

            var sb = new List <string>();

            // check tables
            foreach (var tableName in TableNames)
            {
                if (!schema.Tables.ContainsKey(tableName))
                {
                    sb.Add($"{name}.Tables.dbo.{tableName}");
                }
            }

            foreach (var procedureName in ProcedureNames)
            {
                if (!schema.StoredProcedures.ContainsKey(procedureName))
                {
                    sb.Add($"{name}.Programmability.Stored Procedures.dbo.{procedureName}");
                }
            }

            if (sb.Count > 0)
            {
                var message = "One or several objects are missing in the reporting database. This may happen if EXM SQL script was not run or ended with error. Please refer to EXM installation guide for more details.";
                if (xdbEnabled)
                {
                    output.Error(message, detailed: new DetailedMessage(new BulletedList(sb)));
                }
                else
                {
                    output.Debug(message);
                }
            }
        }
示例#24
0
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            if (data.WebServer.Server.IisVersion.ProductMajorPart < 7)
            {
                output.Error("IIS version is earlier one than officially supported. Sitecore XP supports IIS versions: 7.0, 7.5, 8.0, 8.5");
            }
        }
 public void Process(ISolutionResourceContext data, ITestOutputContext output)
 {
     foreach (var instance in data.Values)
     {
         if (IsActual(instance.ServerRoles, instance.SitecoreInfo.SitecoreVersion, instance))
         {
             Process(instance, new ProxyOutputContext(instance.SitecoreInfo.InstanceName, output));
         }
     }
 }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            foreach (var item in data.SitecoreInfo.ModulesInformation.IncorrectlyInstalledModules)
            {
                if (!item.Value.Any())
                {
                    continue;
                }

                var version = item.Value.Select(
                    ri =>
                    new
                {
                    ri.Release,
                    Data =
                        ri.Assemblies
                        .Select(x => new
                    {
                        x.FileName,
                        Expected = x.FileVersion,
                        Actual   = data.SitecoreInfo.Assemblies.TryGetValue(x.FileName)?.FileVersion ?? "[missing]"
                    })
                        .Where(x => x.Actual != x.Expected)
                })

                              .Select(ri => new
                {
                    ri.Release,
                    ri.Data,
                    Count = ri.Data.Count(),
                })

                              .Where(z => z.Data.Count(x => x.Actual != "[missing]" && x.FileName.StartsWith("Sitecore.", StringComparison.OrdinalIgnoreCase)) > 0) // with at least one existing Sitecore assembly in the list
                              .OrderBy(z => z.Count)
                              .FirstOrDefault();

                if (version == null)
                {
                    continue;
                }

                output.Debug(
                    new DetailedMessage(new Text($"An inconsistent module was detected: "),
                                        new BoldText(item.Key + " " + version.Release.Version.MajorMinorUpdate),
                                        new Table(
                                            version.Data
                                            .ToArray(x =>
                                                     new TableRow(
                                                         new Pair("Assembly", x.FileName),
                                                         new Pair("Actual Version", x.Actual),
                                                         new Pair("Default Version", x.Expected))))));
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var logs = data.Logs.GetSitecoreLogEntries(LogLevel.Warn);

            if (logs.Any(log => log.RawText.Contains(Message)))
            {
                Report(output);
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var warnLogEntries = data.Logs.GetSitecoreLogEntries(LogLevel.Warn);

            if (warnLogEntries.Any(entry => entry.Message.StartsWith("Counter category '") && entry.Message.Contains("' does not exist on this server. Using temporary public counter for '")))
            {
                output.Warning(CountersNotInstalledMessage, Link);
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var logs = data.Logs.GetSitecoreLogEntries(LogLevel.Error);

            if (logs.Any(x => x != null && x.Message.Contains(Pattern)))
            {
                output.Error(Message, Link);
            }
        }
        public override void Process(IInstanceResourceContext data, ITestOutputContext output)
        {
            Assert.ArgumentNotNull(data, nameof(data));

            var pool = data.WebServer.Site.ApplicationPool;

            if (pool.MaxWorkerProcesses > 1)
            {
                output.Error(GetErrorMessage(pool));
            }
        }