public void Parse_Values_GB_Valid_825(uint size) { // act var sut = CacheSize.Parse($"{size}GB", Sc825); // assert Assert.Equal(size, sut.Value.GB); }
public void Parse_Values_MB_Invalid_825(uint size) { // act var sut = CacheSize.Parse($"{size}mb", Sc825); // assert Assert.Equal(0, sut.Value.MB); // kind weird, but that's what it is }
public void Parse_Text(uint size) { // arrange var text = $"{size}"; // act var sut = CacheSize.Parse(text, Sc825); // assert Assert.Equal(text, sut.Text); }
public RunWorkPlan( DataSet dataSet, Cardinality cardinality, IndexType indexType, ReservationBufferSize reservationBufferSize, CacheSize cacheSize, Drive drive, CacheType cacheType, WorkPlan workPlan) : base(dataSet, cardinality, indexType, reservationBufferSize, cacheType, cacheSize) { Drive = drive; WorkPlan = workPlan; }
public Experiment( DataSet dataSet, Cardinality cardinality, IndexType indexType, ReservationBufferSize reservationBufferSize, CacheType cacheType, CacheSize cacheSize) { DataSet = dataSet; Cardinality = cardinality; IndexType = indexType; ReservationBufferSize = reservationBufferSize; CacheType = cacheType; CacheSize = cacheSize; }
/// <summary> /// Returns true if ComAdobeCqSocialDatastoreAsImplASResourceProviderFactoryProperties instances are equal /// </summary> /// <param name="other">Instance of ComAdobeCqSocialDatastoreAsImplASResourceProviderFactoryProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ComAdobeCqSocialDatastoreAsImplASResourceProviderFactoryProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( VersionId == other.VersionId || VersionId != null && VersionId.Equals(other.VersionId) ) && ( CacheOn == other.CacheOn || CacheOn != null && CacheOn.Equals(other.CacheOn) ) && ( ConcurrencyLevel == other.ConcurrencyLevel || ConcurrencyLevel != null && ConcurrencyLevel.Equals(other.ConcurrencyLevel) ) && ( CacheStartSize == other.CacheStartSize || CacheStartSize != null && CacheStartSize.Equals(other.CacheStartSize) ) && ( CacheTtl == other.CacheTtl || CacheTtl != null && CacheTtl.Equals(other.CacheTtl) ) && ( CacheSize == other.CacheSize || CacheSize != null && CacheSize.Equals(other.CacheSize) ) && ( TimeLimit == other.TimeLimit || TimeLimit != null && TimeLimit.Equals(other.TimeLimit) )); }
public override int GetHashCode() { return(C.GetHashCode() + CacheSize.GetHashCode() + Coefficient0.GetHashCode() + Degree.GetHashCode() + EPS.GetHashCode() + Gamma.GetHashCode() + KernelType.GetHashCode() + Nu.GetHashCode() + P.GetHashCode() + Probability.GetHashCode() + Shrinking.GetHashCode() + SvmType.GetHashCode() + Weights.ToArray().ComputeHashcode()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (VersionId != null) { hashCode = hashCode * 59 + VersionId.GetHashCode(); } if (CacheOn != null) { hashCode = hashCode * 59 + CacheOn.GetHashCode(); } if (ConcurrencyLevel != null) { hashCode = hashCode * 59 + ConcurrencyLevel.GetHashCode(); } if (CacheStartSize != null) { hashCode = hashCode * 59 + CacheStartSize.GetHashCode(); } if (CacheTtl != null) { hashCode = hashCode * 59 + CacheTtl.GetHashCode(); } if (CacheSize != null) { hashCode = hashCode * 59 + CacheSize.GetHashCode(); } if (TimeLimit != null) { hashCode = hashCode * 59 + TimeLimit.GetHashCode(); } return(hashCode); } }
public void TestFailData() { var data = new Map { { "data", "20MB" }, { "items", "10MB" }, // {"paths", "500KB"}, // no itempaths to make it fallback to default cache size 100KB { "itempaths", "1MB" }, { "standardValues", "50KB" }, { "prefetch", "1MB" } }; new SolutionUnitTestContext() .AddInstance(new SitecoreInstance { Configuration = new XmlDocument() .Create(CacheSizesXPath) .Add(CacheSizesXPath, "data", data["data"]) .Add(CacheSizesXPath, "items", data["items"]) //.Add(CacheSizesXPath, "paths", data["paths"]) .Add(CacheSizesXPath, "itempaths", data["itempaths"]) .Add(CacheSizesXPath, "standardValues", data["standardValues"]) .Add(WebDatabaseXPath, PrefetchXPath, data["prefetch"]), Version = Sc711 }) .Process(this) .MustReturn(new TestOutput(TestResultState.Warning, new ShortMessage(new Text($"One or several Sitecore caches are not tuned up and use default settings which may lead to performance degradation:")), data: GetMessage(new Map <Map <CacheSizeDetails> > { { "web", new Map <CacheSizeDetails> { { "data", new CacheSizeDetails { Value = CacheSize.Parse(data["data"], Sc711), Comment = "which is default" } }, { "items", new CacheSizeDetails { Value = CacheSize.Parse(data["items"], Sc711), Comment = "which is default" } }, } } }))) .MustReturn(new TestOutput(TestResultState.Error, new ShortMessage(new Text($"One or several Sitecore caches are use custom configuration which is below the minimum recommended values (set up by default) which may lead to performance degradation:")), data: GetMessage(new Map <Map <CacheSizeDetails> > { { "web", new Map <CacheSizeDetails> { { "paths", new CacheSizeDetails { Value = CacheSize.Parse("100KB", Sc711), Comment = "cache size is not specified, uses Caching.DefaultPathCacheSize setting value as fallback" } }, { "standardValues", new CacheSizeDetails { Value = CacheSize.Parse(data["standardValues"], Sc711), Comment = $"which is below than default: {Size.FromKB(500)}" } }, { "itempaths", new CacheSizeDetails { Value = CacheSize.Parse(data["itempaths"], Sc711), Comment = $"which is below than default: {Size.FromMB(10)}" } }, { "prefetch", new CacheSizeDetails { Value = CacheSize.Parse(data["prefetch"], Sc711), Comment = $"which is below than default: {Size.FromMB(10)}" } } } } }))) .Done(); }
private void Process(ISitecoreInformationContext info, ITestOutputContext output, LogicalDatabaseDefinition database, LogicalDatabaseDefinition defaultDatabase, Map<Map<CacheSizeDetails>> defaultCachesPerDatabase, Map<Map<CacheSizeDetails>> belowDefaultCachesPerDatabase) { var databaseCaches = new Map<CacheSizeDetails>(); var belowDefaultCaches = new Map<CacheSizeDetails>(); var databaseName = database.Name; foreach (var cache in database.Caches.Values) { var cacheSize = cache.Size; var defaultSize = defaultDatabase.Caches[cache.Name].Size; if (defaultSize == null) { // custom cache, or filesystem database continue; } if (cacheSize == null) { var fallbackSettingCacheSize = CacheSize.Parse(info.GetSetting(cache.FallbackSettingName), info.SitecoreVersion); if (fallbackSettingCacheSize.Value.Bytes < defaultSize.Value.Bytes) { var cacheSizeDetails = new CacheSizeDetails { Value = fallbackSettingCacheSize, Comment = $"cache size is not specified, uses {cache.FallbackSettingName} setting value as fallback" }; belowDefaultCaches.Add(cache.Name, cacheSizeDetails); } } else { if (cacheSize.Value == defaultSize.Value) { var cacheSizeDetails = new CacheSizeDetails { Value = cacheSize, Comment = "cache size is default" }; databaseCaches.Add(cache.Name, cacheSizeDetails); } else if (cacheSize.Value < defaultSize.Value) { var cacheSizeDetails = new CacheSizeDetails { Value = cacheSize, Comment = $"cache size is below than default: {defaultSize.Value}" }; belowDefaultCaches.Add(cache.Name, cacheSizeDetails); } } } if (databaseCaches.Any()) { defaultCachesPerDatabase.Add(databaseName, databaseCaches); } if (belowDefaultCaches.Any()) { belowDefaultCachesPerDatabase.Add(databaseName, belowDefaultCaches); } }