public ABTestCaseSet[] GetABTestCases(BrandEntity brand, SkinEntity skin) { var skinCode = new SkinCode(brand.Id, skin.Id); var fileDescriptors = DiscoverFilesDescriptors(); return(FindABTestCases(brand, skin).Where(tc => tc.AppliesTo(skinCode, fileDescriptors)).ToArray()); }
public void Constructor_ReceivesBrandAndSkin_SetsTheBrandAndSkinProperties() { var skinCode = new SkinCode(1, 5); Assert.AreEqual(1, skinCode.BrandId); Assert.AreEqual(5, skinCode.SkinId); }
public void Constructor_ReceivesTheSkinCode(int code, int expectedBrandId, int expectedSkinId) { var skinCode = new SkinCode(code); Assert.AreEqual(expectedBrandId, skinCode.BrandId); Assert.AreEqual(expectedSkinId, skinCode.SkinId); }
public void Read_ConfigurationFileWithTestCasesDefined_FilesOverridesAreCorrectlyRead() { var brand = new BrandEntity(1, "888Casino", "http://localhost/casino"); var skin = new SkinEntity(4, "Non UK"); var webClient = Substitute.For <IWebClient>(); webClient.DownloadStringReturns("http://localhost/casino/application/ABTesting_Configuration.xml", @"<test ID='2' Name='Test name as string' Description='Long description of the test'> <test_cases brand='0' skin='4' lang='en'> <test_case ID='1' IsDefault='true' Method='1' Name='Acquisition' UsePercentage='93.55' Description='Acquisition login test case' ClientPath='../../setups/ab-testing/fileMapping1.xml'/> <test_case ID='2' IsDefault='false' Method='1' Name='Test' UsePercentage='6.45' Description='test case' ClientPath='../../a/b/test.xml'/> </test_cases> </test>"); webClient.DownloadStringReturns("http://localhost/casino/versionX/setups/ab-testing/fileMapping1.xml", @"<overrides> <overrides originalFile='../../bin/application/version.xml' overrideFile='../../setups/ab-testing/FLASH_MLNG/version.xml'/> </overrides>"); webClient.DownloadStringReturns("http://localhost/casino/versionX/a/b/test.xml", @"<overrides> <overrides originalFile='../../navigation/plan/4/navigation_plan_ndl.xmm' overrideFile='../../setups/ab-testing/HTML5_MLNG/navigation_plan_ndl.xmm'/> <overrides originalFile='../../navigation/plan/games_properties.xmm' overrideFile='../../setups/ab-testing/HTML5_MLNG/games_properties.xmm'/> <overrides type='configuration' originalFile='../../brand/brand_%BRAND%/skin_%SKIN%/skin.xml' overrideFile='../../setups/ab-testing/testCase1/skin.xml'/> </overrides>"); var skinCode = new SkinCode(0, 4); var reader = CreateReader(webClient, CreateClientUrlBuilder(brand, skin)); var configuration = reader.Read(brand.CDNUrl); var testCases = configuration.TestCaseSets[0]; var test = testCases[0]; Assert.AreEqual(1, test.FilesOverride.Count); var file = test.FilesOverride[0]; AssertEquals("../../bin/application/version.xml", file.GetOriginalFile(skinCode)); AssertEquals("../../setups/ab-testing/FLASH_MLNG/version.xml", file.OverrideFile); test = testCases[1]; Assert.AreEqual(3, test.FilesOverride.Count); file = test.FilesOverride[0]; AssertEquals("../../navigation/plan/4/navigation_plan_ndl.xmm", file.GetOriginalFile(skinCode)); AssertEquals("../../setups/ab-testing/HTML5_MLNG/navigation_plan_ndl.xmm", file.OverrideFile); file = test.FilesOverride[1]; AssertEquals("../../navigation/plan/games_properties.xmm", file.GetOriginalFile(skinCode)); AssertEquals("../../setups/ab-testing/HTML5_MLNG/games_properties.xmm", file.OverrideFile); file = test.FilesOverride[2]; AssertEquals("../../brand/brand_0/skin_4/skin.xml", file.GetOriginalFile(skinCode)); AssertEquals("../../setups/ab-testing/testCase1/skin.xml", file.OverrideFile); }
public void ComputeUrl_ShouldReturnTheCorrectUrlAccordingWithTheBrandAndSkin() { var fileDescriptor = CreateFileDescriptor(); var skinCode = new SkinCode(1, 2); var url = fileDescriptor.ComputeUrl("http://ndl-cdn.safe-iplay.com/casino/6.4-0-270c/", skinCode); Assert.AreEqual("http://ndl-cdn.safe-iplay.com/casino/6.4-0-270c/navigation/plan/102/navigation_plan_ndl.xmm", url); }
public ClientLaunchConfigurationBuilder(SkinCode skinCode, string theme, string defaultSkin, string languageId) { _skinCode = skinCode; this.theme = theme; this.defaultSkin = defaultSkin; this.languageId = languageId; this.brand = skinCode.BrandId.ToString(); this.skin = skinCode.SkinId.ToString(); }
private ThemeEntry FindThemeEntry(SkinCode skinCode) { var themeEntries = this.ThemeEntries.Where(te => te.Brand == skinCode.BrandId.ToString() && te.Skin == skinCode.SkinId.ToString()); if (!themeEntries.Any()) { throw new ArgumentException($"Can't find a Theme Entry in the preloader_setup.json for Brand {skinCode.BrandId} and Skin {skinCode.SkinId}"); } var themeEntry = themeEntries.FirstOrDefault(te => te.Language.ToLowerInvariant().Contains("en")); if (themeEntry != null) { return(themeEntry); } return(ThemeEntries.First()); }
private List <ClientConfigurationFile <IJsonConfigurationFileDescriptor> > CreateFiles( IEnumerable <IJsonConfigurationFileDescriptor> fileDescriptors, PathDescriptor rootFolder, SkinCode skinCode, ABTestCase abTest) { var files = new List <ClientConfigurationFile <IJsonConfigurationFileDescriptor> >(); foreach (var fileDescriptor in fileDescriptors) { var fullPath = BuildFullPath(fileDescriptor, rootFolder, skinCode, abTest); var json = TextFileReader.ReadAllText(fullPath); files.Add(new ClientConfigurationFile <IJsonConfigurationFileDescriptor>(fullPath, json, fileDescriptor)); } return(files); }
protected override void RestoreStateCore(SkinIndentity skinIdentity) { var property = skinIdentity.Selector.Properties.FirstOrDefault(p => p.Name == "SelectedWebSite"); if (property != null) { this.SelectedWebSite = this.WebSites.FirstOrDefault(w => w.Name == property.Value); } property = skinIdentity.Selector.Properties.FirstOrDefault(p => p.Name == "SelectedVirtualDirectory"); if (property != null) { this.SelectedVirtualDirectory = this.VirtualDirectories.FirstOrDefault(d => d.Name == property.Value); } var skinCode = new SkinCode(skinIdentity.BrandId, skinIdentity.SkinId); this.SelectedSkinCode = this.SkinCodes.FirstOrDefault(sc => sc.Code == skinCode.Code); }
public ABTestCaseSet[] GetABTestCases(BrandEntity brand, SkinEntity skin) { var preloaderSetup = GetPreloaderSetup(brand, skin); var skinCode = new SkinCode(brand.Id, skin.Id); var fileDescriptors = preloaderSetup.GetFileDescriptors(brand, skin); var result = new List <ABTestCaseSet>(); foreach (var testCase in FindABTestCases(brand, skin, preloaderSetup)) { if (testCase.AppliesTo(skinCode, fileDescriptors)) { result.Add(testCase); } } return(result.ToArray()); }
public IClientLaunchConfigurationBuilder GetLaunchConfigurationBuilder(SkinCode skinCode) { var themeEntry = FindThemeEntry(skinCode); var themePaths = FindThemePaths(themeEntry.ClientProfile.Theme); var config = new ClientLaunchConfigurationBuilder(skinCode, themeEntry.ClientProfile.Theme, themeEntry.ClientProfile.DefaultSkin, themeEntry.ClientProfile.LanguageId); config.AddConfigurationFile("navigationPlanPath", new PathDescriptor(themeEntry.ClientProfile.NavigationPlanPath)); config.AddConfigurationFile("zippedResourcesPath", new PathDescriptor(themeEntry.ClientProfile.ZippedResourcesPath)); config.AddConfigurationFile("iconResources", new PathDescriptor(themeEntry.ClientProfile.IconResources)); config.AddConfigurationFile("languagePath", new PathDescriptor(themeEntry.ClientProfile.LanguagePath)); config.AddConfigurationFile("themePath", new PathDescriptor(themePaths.ConfigPath)); config.AddConfigurationFile("lobbyThemePath_JS", new PathDescriptor(themePaths.LobbyThemePath_JS)); config.AddConfigurationFile("lobbyThemePath", new PathDescriptor(themePaths.LobbyThemePath)); config.AddConfigurationFile("preloaderPath_JS", new PathDescriptor(themePaths.PreloaderPath_JS)); config.AddConfigurationFile("preloaderPath", new PathDescriptor(themePaths.PreloaderPath)); config.AddConfigurationFile("preloaderLogoPath", new PathDescriptor(themePaths.PreloaderLogoPath)); return(config); }
public override PathDescriptor GetRelativePath(SkinCode skinCode) { return(new PathDescriptor($"navigation/plan/{DefaultFileName}")); }
public void Constructor_ReceivesBrandAndSkin(int expectedCode, int brandId, int skinId) { var skinCode = new SkinCode(brandId, skinId); Assert.AreEqual(expectedCode, skinCode.Code); }
private PathDescriptor BuildFullPath(IConfigurationFileDescriptor fileDescriptor, PathDescriptor rootFolder, SkinCode skinCode, ABTestCase abTest) { PathDescriptor relativeFilePath = null; if (abTest != null) { relativeFilePath = abTest.GetOverrideFileOrNull(fileDescriptor, skinCode); } if (relativeFilePath == null) { relativeFilePath = fileDescriptor.GetRelativePath(skinCode); } return(rootFolder + relativeFilePath); }
private List <ClientConfigurationFile <IXmlConfigurationFileDescriptor> > CreateFiles(SkinCode skinCode, PathDescriptor rootFolder, ABTestCase abTest) { var files = new List <ClientConfigurationFile <IXmlConfigurationFileDescriptor> >(); foreach (var fileDescriptor in DiscoverFilesDescriptors()) { var fullPath = BuildFullPath(fileDescriptor, rootFolder, skinCode, abTest); var xml = TextFileReader.ReadAllText(fullPath); files.Add(new ClientConfigurationFile <IXmlConfigurationFileDescriptor>(fullPath, xml, fileDescriptor)); } return(files); }
public XmlClientUrlBuilder(PathDescriptor cdnUrl, SkinCode skinCode, string version) : base(cdnUrl, skinCode, version) { }
public PathDescriptor GetRelativePath(SkinCode skinCode) { return(_relativePath); }
public override PathDescriptor GetRelativePath(SkinCode skinCode) { return(new PathDescriptor($"brand/brand_{skinCode.BrandId}/skin_{skinCode.SkinId}/{DefaultFileName}")); }
public JsonClientUrlBuilder(PathDescriptor cdnUrl, SkinCode skinCode, string version, IPreloaderSetup preloaderSetup) : base(cdnUrl, skinCode, version) { _preloaderSetup = preloaderSetup; }
public void Constructor_ReceivesTheSkinCodeSetsTheCodeProperty() { var skinCode = new SkinCode(4); Assert.AreEqual(4, skinCode.Code); }
public abstract PathDescriptor GetRelativePath(SkinCode skinCode);
public ClientUrlBuilder(PathDescriptor cdnUrl, SkinCode skinCode, string version) { CdnUrl = cdnUrl; SkinCode = skinCode; Version = version; }