예제 #1
0
        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());
        }
예제 #2
0
        public void Constructor_ReceivesBrandAndSkin_SetsTheBrandAndSkinProperties()
        {
            var skinCode = new SkinCode(1, 5);

            Assert.AreEqual(1, skinCode.BrandId);
            Assert.AreEqual(5, skinCode.SkinId);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 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();
 }
예제 #7
0
        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());
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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());
        }
예제 #11
0
        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);
        }
예제 #12
0
 public override PathDescriptor GetRelativePath(SkinCode skinCode)
 {
     return(new PathDescriptor($"navigation/plan/{DefaultFileName}"));
 }
예제 #13
0
        public void Constructor_ReceivesBrandAndSkin(int expectedCode, int brandId, int skinId)
        {
            var skinCode = new SkinCode(brandId, skinId);

            Assert.AreEqual(expectedCode, skinCode.Code);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
 public XmlClientUrlBuilder(PathDescriptor cdnUrl, SkinCode skinCode, string version)
     : base(cdnUrl, skinCode, version)
 {
 }
예제 #17
0
 public PathDescriptor GetRelativePath(SkinCode skinCode)
 {
     return(_relativePath);
 }
예제 #18
0
 public override PathDescriptor GetRelativePath(SkinCode skinCode)
 {
     return(new PathDescriptor($"brand/brand_{skinCode.BrandId}/skin_{skinCode.SkinId}/{DefaultFileName}"));
 }
예제 #19
0
 public JsonClientUrlBuilder(PathDescriptor cdnUrl, SkinCode skinCode, string version, IPreloaderSetup preloaderSetup)
     : base(cdnUrl, skinCode, version)
 {
     _preloaderSetup = preloaderSetup;
 }
예제 #20
0
        public void Constructor_ReceivesTheSkinCodeSetsTheCodeProperty()
        {
            var skinCode = new SkinCode(4);

            Assert.AreEqual(4, skinCode.Code);
        }
예제 #21
0
 public abstract PathDescriptor GetRelativePath(SkinCode skinCode);
예제 #22
0
 public ClientUrlBuilder(PathDescriptor cdnUrl, SkinCode skinCode, string version)
 {
     CdnUrl   = cdnUrl;
     SkinCode = skinCode;
     Version  = version;
 }