public void Init() { _timer = new TestTimer(false); _eventMemoryCache = new MemoryCache("EventCache"); _profileCache = new MemoryCache("ProfileCache"); _statusMemoryCache = new MemoryCache("StatusCache"); _cacheManager = new CacheManager(); _dataRouterManager = new TestDataRouterManager(_cacheManager); var sportEventCacheItemFactory = new SportEventCacheItemFactory(_dataRouterManager, new SemaphorePool(5), TestData.Culture, new MemoryCache("FixtureTimestampCache")); var profileCache = new ProfileCache(_profileCache, _dataRouterManager, _cacheManager); SportEventCache = new SportEventCache(_eventMemoryCache, _dataRouterManager, sportEventCacheItemFactory, _timer, TestData.Cultures3, _cacheManager); SportDataCache = new SportDataCache(_dataRouterManager, _timer, TestData.Cultures3, SportEventCache, _cacheManager); var sportEventStatusCache = new TestLocalizedNamedValueCache(); var namedValuesProviderMock = new Mock <INamedValuesProvider>(); namedValuesProviderMock.Setup(args => args.MatchStatuses).Returns(sportEventStatusCache); EventStatusCache = new SportEventStatusCache(_statusMemoryCache, new SportEventStatusMapperFactory(), SportEventCache, _cacheManager, TimeSpan.Zero); SportEntityFactory = new SportEntityFactory(SportDataCache, SportEventCache, EventStatusCache, sportEventStatusCache, profileCache, SdkInfo.SoccerSportUrns); }
public int FetchInt(string groupName, string elementName) { int value = (int)ContainerElement.Descendants(groupName).First().Element(elementName); ProfileCache.Store(elementName, value.ToString()); return(value); }
public bool FetchBool(string groupName, string elementName) { bool value = (bool)ContainerElement.Descendants(groupName).First().Element(elementName); ProfileCache.Store(elementName, value.ToString()); return(value); }
public ProfileDetailsViewModel(MobiContext context, ProfileCache profile) : base(context) { this._profile = profile; this._additionalImages = ProfileThumbnail.CreateManager().Load(this.Profile, MobiChat.Data.ThumbnailIdentifier.NotDefault); this._descriptionValues = ProfileDetailValue.Generate(this.ProfileDetails); }
public ProfileDeepData LoadProfileDeepData(MyProfile profile) { _cacheProfileById.TryGetValue(profile.Id, out var cacheProfile); if (cacheProfile == null) { cacheProfile = new ProfileCache(profile); } if (cacheProfile.IsDeepLoad == false || !_enableCache) { var testTypes = new Dictionary <long, long>(); _testTypeSelect.Parameters["@PROF_ID"].Value = profile.Id; using (var reader = _testTypeSelect.ExecuteReader()) while (reader.Read()) { testTypes.Add(reader.GetInt32(0), reader.GetInt32(1)); } foreach (var testType in testTypes) { FillParameters(cacheProfile.Profile.DeepData, testType.Key, testType.Value); } if (_enableCache) { cacheProfile.IsDeepLoad = true; _cacheProfileById[profile.Id] = cacheProfile; } } return(cacheProfile.Profile.DeepData.Copy()); }
public string Fetch(string groupName, string elementName) { string value = (string)ContainerElement.Descendants(groupName).First().Element(elementName); value = Substitute(value); ProfileCache.Store(elementName, value); return(value); }
public void Load() { XDoc = XDocument.Load(ProfileCache.Fetch("SystemProfileXml")); XmlProfileHelper = new XmlProfileHelper(ProfileCache, XDoc.Root); XmlProfileHelper.FetchAll("Parameters"); XmlProfileHelper.FetchAll("Directories"); XmlProfileHelper.FetchAll("Files"); XmlProfileHelper.FetchAll("Programs"); }
public ProfileManager() { ProfileCache = new ProfileCache(); ApplicationProfile = new ApplicationProfile(ProfileCache); SystemProfile = new SystemProfile(ProfileCache); UserSettings = new UserSettings(ProfileCache); UserSettings.Load(SystemProfile.CurrentUserSettings, SystemProfile.MasterUserSettings); Interrupt = new Interrupt("OK"); }
public ProfileManager() { ProfileCache = new ProfileCache(); ApplicationProfile = new ApplicationProfile(ProfileCache); SystemProfile = new SystemProfile(ProfileCache); UserSettings = new UserSettings(ProfileCache); UserSettings.Load(SystemProfile.CurrentUserSettings, SystemProfile.MasterUserSettings); DiffUserSettings = new DiffUserSettings(ProfileCache); DiffUserSettings.Load(SystemProfile.DiffCurrentUserSettings, SystemProfile.DiffMasterUserSettings); }
public ApplicationProfile(ProfileCache profileCache) { _profileCache = profileCache; _startupPath = Application.StartupPath.Trim(); _userName = System.Environment.UserName; _AssemblyVersion = GetAssemblyVersion(); _profileCache.Store("DataPath", DataPath); _profileCache.Store("SystemProfileXml", SystemProfileXml); _profileCache.Store("UserName", UserName); _profileCache.Store("Version", Version); }
public void Init() { _cacheManager = new CacheManager(); _dataRouterManager = new TestDataRouterManager(_cacheManager); _timer = new TestTimer(false); _sportEventCache = new SportEventCache(new MemoryCache("tournamentDetailsCache"), _dataRouterManager, new SportEventCacheItemFactory(_dataRouterManager, new SemaphorePool(5, ExceptionHandlingStrategy.THROW), TestData.Cultures.First(), new MemoryCache("FixtureTimestampCache")), _timer, TestData.Cultures, _cacheManager); _sportDataCache = new SportDataCache(_dataRouterManager, _timer, TestData.Cultures, _sportEventCache, _cacheManager); _profileMemoryCache = new MemoryCache("profileCache"); _profileCache = new ProfileCache(_profileMemoryCache, _dataRouterManager, _cacheManager); }
public void StoreProfileThrowsExceptionWithNullProfileTest() { var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); var sut = new ProfileCache(cache, config); Action action = () => sut.StoreProfile(null); action.Should().Throw <ArgumentNullException>(); }
public void RemoveProfileThrowsExceptionWithEmptyIdTest() { var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); var sut = new ProfileCache(cache, config); Action action = () => sut.RemoveProfile(Guid.Empty); action.Should().Throw <ArgumentException>(); }
public ProfileManager() { ProfileCache = new ProfileCache(); ApplicationProfile = new ApplicationProfile(ProfileCache); SystemProfile = new SystemProfile(ProfileCache); if (SystemProfile.MasterCriteria != null) { FileHelper.EnsureExists(SystemProfile.CurrentCriteria, SystemProfile.MasterCriteria); } UserSettings = new UserSettings(ProfileCache); UserSettings.Load(SystemProfile.CurrentUserSettings, SystemProfile.MasterUserSettings); }
public void GetProfileThrowsExceptionWithInvalidIdTest() { var id = Guid.Empty; var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); var sut = new ProfileCache(cache, config); Action action = () => sut.GetProfile(id); action.Should().Throw <ArgumentException>(); }
public ActionResult InsertNumber(string id) { ProfileCache profileCacheObj = (this.MobiContext.Service.Cache as ChatCache).GetProfileByID(id); if (profileCacheObj == null) { Log.Error("Could not load profile with iD:{0} from cache"); return(this.InternalError()); } InsertNumberModel model = new InsertNumberModel(this.MobiContext, profileCacheObj); return(View("InsertNumber", model)); }
public void RemoveProfileDeletesProfileFromCacheTest() { var expected = Model.Create <Profile>(); var cacheKey = "Profile|" + expected.Id; var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); var sut = new ProfileCache(cache, config); sut.RemoveProfile(expected.Id); cache.Received().Remove(cacheKey); }
public ApplicationProfile(ProfileCache profileCache) { _profileCache = profileCache; GetCustomAttributes(); _masterDataPath = GetMasterDataPath(); _dataPath = GetApplicationDataPath(); _assemblyVersion = GetAssemblyVersion(); _profileCache.Store("MasterDataPath", MasterDataPath); _profileCache.Store("DataPath", DataPath); _profileCache.Store("SystemProfileXml", SystemProfileXml); _profileCache.Store("UserName", UserName); _profileCache.Store("Version", Version); _profileCache.Store("AssemblyTitle", AssemblyTitle); _profileCache.Store("AssemblyProduct", AssemblyProduct); }
public void GetProfileResultsReturnsNullWhenCachedProfileResultsNotFoundTest() { const string CacheKey = "ProfileResults"; var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); object value; cache.TryGetValue(CacheKey, out value).Returns(x => false); var sut = new ProfileCache(cache, config); var actual = sut.GetProfileResults(); actual.Should().BeNull(); }
public void GetProfileReturnsNullWhenCachedProfileNotFoundTest() { var id = Guid.NewGuid(); var cacheKey = "Profile|" + id; var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); object value; cache.TryGetValue(cacheKey, out value).Returns(x => false); var sut = new ProfileCache(cache, config); var actual = sut.GetProfile(id); actual.Should().BeNull(); }
public PacChatServer() { instance = this; new ServerSettings(); protocolProvider = new ProtocolProvider(); SessionRegistry = new SessionRegistry(); Mongo.StartService(); ProfileCache.StartService(); CommandManager.StartService(); RegisterCommand(); Sticker.StartService(); StartNetworkService(); }
public ProfileManager() { ProfileCache = new ProfileCache(); ApplicationProfile = new ApplicationProfile(ProfileCache); if (!File.Exists(ApplicationProfile.SystemProfileXml)) { if (Directory.Exists(ApplicationProfile.DataPath)) { FileHelper.DeleteAll(ApplicationProfile.DataPath); } } EnsureXCopy(ApplicationProfile.MasterDataPath, ApplicationProfile.DataPath); SystemProfile = new SystemProfile(ProfileCache); RepositorySettings = new RepositorySettings(ProfileCache); RepositorySettings.Load(SystemProfile.RepositorySettings); TemplateSettings = new TemplateParameterSettings(ProfileCache); TemplateSettings.Load(SystemProfile.TemplateSettings); Reload(); }
public void StoreProfileWritesProfileToCacheTest() { var expected = Model.Create <Profile>(); var cacheExpiry = TimeSpan.FromMinutes(23); var cacheKey = "Profile|" + expected.Id; var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); var cacheEntry = Substitute.For <ICacheEntry>(); config.ProfileExpiration.Returns(cacheExpiry); cache.CreateEntry(cacheKey).Returns(cacheEntry); var sut = new ProfileCache(cache, config); sut.StoreProfile(expected); cacheEntry.Value.Should().Be(expected); cacheEntry.SlidingExpiration.Should().Be(cacheExpiry); }
public void GetProfileReturnsCachedProfileTest() { var expected = Model.Create <Profile>(); var cacheKey = "Profile|" + expected.Id; var cache = Substitute.For <IMemoryCache>(); var config = Substitute.For <ICacheConfig>(); object value; cache.TryGetValue(cacheKey, out value).Returns( x => { x[1] = expected; return(true); }); var sut = new ProfileCache(cache, config); var actual = sut.GetProfile(expected.Id); actual.Should().BeEquivalentTo(expected); }
public UserSettings(string fileSpec, ProfileCache profileCache) : base("Profile", "UserSettings", "UserSetting", "Key", fileSpec, null) { ProfileCache = profileCache; }
public UserSettings(ProfileCache profileCache) : this(null, profileCache) { }
public ProfileManager() { ProfileCache = new ProfileCache(); ApplicationProfile = new ApplicationProfile(ProfileCache); SystemProfile = new SystemProfile(ProfileCache); }
public TemplateParameterSettings(ProfileCache profileCache) : this(null, profileCache) { }
public SystemProfile(ProfileCache profileCache) { ProfileCache = profileCache; Load(); }
public TemplateParameterSettings(string fileSpec, ProfileCache profileCache) : base("Profile", "TemplateParameterSettings", "TemplateParameterSetting", "Key", fileSpec, null) { ProfileCache = profileCache; }