Exemple #1
0
        public override PathDescriptor BuildLaunchUrl(ABTestCase abTest, EnvironmentConnection environmentConnection)
        {
            var launchConfiguration = _preloaderSetup.GetLaunchConfigurationBuilder(SkinCode);

            var configData = launchConfiguration.Build(abTest, environmentConnection);

            return(BuildBaseUrl(abTest) +
                   new PathDescriptor($"bin/application/ViewActual.html?entrancemode=1&navigationplanid=-1&languageid=en&brandid={SkinCode.BrandId}&skinid={SkinCode.SkinId}&isdebugmode=1&isSelectedDebugHost=0&GRSState=LATEST&GRSAdditionalState=LATEST&GRSGameTechnology=DEFAULT&CommunicationType=socketProxy&Environment={environmentConnection.Name}&preloaderSetupPath=preloader_setup.json&configData={configData}"));
        }
Exemple #2
0
        public override PathDescriptor BuildLaunchUrl(ABTestCase abTest, EnvironmentConnection environmentConnection)
        {
            string abTestingOverridePathUrlParameter = abTest?.GetOverrideParameterPathUrlParameter();


#warning I might need to do something with languageid parameter

            //var antiCacheKey = new Random().Next();
            //antiCacheKey ={ antiCacheKey}&

            return(BuildBaseUrl(abTest) +
                   new PathDescriptor($"bin/application/ViewActual.html?navigationplanid=-1&languageid=en&brandid={SkinCode.BrandId}&skinid={SkinCode.SkinId}{abTestingOverridePathUrlParameter}"));
        }
Exemple #3
0
        public PathDescriptor BuildBaseUrl(ABTestCase abTest)
        {
            if (abTest == null || abTest.Method != ABTestMethod.FullClient)
            {
                return(GetDefaultBaseUrl());
            }


            if (abTest.ClientPath.IsEmpty())
            {
                return(GetDefaultBaseUrl());
            }
            else
            {
                return(CdnUrl + abTest.ClientPath);
            }
        }
Exemple #4
0
        private ABTestConfiguration ParseABTestingConfiguration(string xml, IClientUrlBuilder clientUrlInfo, IWebClient webClient)
        {
            var xmlDoc = XmlUtils.Parse(xml);

            var root = xmlDoc.Root;

            var abTestConfiguration = new ABTestConfiguration(root.GetAttributeValue("ID"),
                                                              root.GetAttributeValue("Name"),
                                                              root.GetAttributeValue("Description"));


            foreach (var testCasesElement in root.Elements("test_cases"))
            {
                var testCasesCollection = new ABTestCaseSet(abTestConfiguration.Id,
                                                            testCasesElement.GetAttributeValue("brand"),
                                                            testCasesElement.GetAttributeValue("skin"),
                                                            testCasesElement.GetAttributeValue("lang"));

                foreach (var tcElement in testCasesElement.Elements("test_case"))
                {
                    var abTest = new ABTestCase(tcElement.GetAttributeValue("ID"),
                                                tcElement.GetAttributeValue <bool>("IsDefault"),
                                                tcElement.GetAttributeValue <ABTestMethod>("Method"),
                                                tcElement.GetAttributeValue("Name"),
                                                tcElement.GetAttributeValue <decimal>("UsePercentage"),
                                                tcElement.GetAttributeValue("Description"),
                                                new PathDescriptor(tcElement.GetAttributeValue("ClientPath")));


                    if (abTest.Method == ABTestMethod.Override)
                    {
                        abTest.FilesOverride = ReadFilesOverride(webClient, clientUrlInfo, abTest.ClientPath);
                    }

                    testCasesCollection.Add(abTest);
                }

                if (testCasesCollection.Count > 0)
                {
                    abTestConfiguration.TestCaseSets.Add(testCasesCollection);
                }
            }

            return(abTestConfiguration);
        }
Exemple #5
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);
        }
Exemple #6
0
        public ClientUrlBuilderViewModel(BrandEntity brand,
                                         SkinEntity skin,
                                         ABTestCase abTest,
                                         IClientInformationProvider clientInformationProvider)
        {
            _brand  = brand;
            _skin   = skin;
            _abTest = abTest;
            _clientInformationProvider = clientInformationProvider;
            _clientUrlBuilder          = clientInformationProvider.GetClientUrlBuilder(brand, skin);
            _environmentsConnections   = clientInformationProvider.GetEnvironmentsConnections(brand, skin);
#warning maybe I should do something with this hard coded PRODUCTION value.
            _selectedEnvironmentConnection = _environmentsConnections.FirstOrDefault(e => e.Name == "PRODUCTION");
            if (_selectedEnvironmentConnection == null)
            {
                _selectedEnvironmentConnection = _environmentsConnections.FirstOrDefault();
            }
            UpdateSocketsSetupOverrideProvider();
        }
Exemple #7
0
        public string Build(ABTestCase abTest, EnvironmentConnection environmentConnection)
        {
            JObject jObject = new JObject();

            jObject.Add(new JProperty(nameof(theme), JValue.CreateString(theme)));
#warning defaultSkin and languageId are obsolete since 7.42
            jObject.Add(new JProperty(nameof(defaultSkin), JValue.CreateString(defaultSkin)));
            jObject.Add(new JProperty(nameof(languageId), JValue.CreateString(languageId)));

            jObject.Add(new JProperty(nameof(brand), JValue.CreateString(brand)));
            jObject.Add(new JProperty(nameof(skin), JValue.CreateString(skin)));
            jObject.Add(new JProperty(nameof(lang), JValue.CreateString(lang)));



            foreach (var configurationFile in _configurationFiles)
            {
                jObject.Add(CreateConfigurationFileProperty(configurationFile.Key, ApplyAbTestCase(abTest, configurationFile.Value)));
            }

            jObject.Add(CreateConfigurationFileProperty("environmentPath", ApplyAbTestCase(abTest, environmentConnection.ConfigurationFilePath)));

            return(HttpUtility.UrlEncode(jObject.ToString()));
        }
Exemple #8
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);
        }
Exemple #9
0
        private ABTestConfiguration ParseABTestingConfiguration(string abTestConfigContent)
        {
            var languageJson = JsonConvert.DeserializeObject <dynamic>(abTestConfigContent);

            var config = new ABTestConfiguration();

            if (languageJson.abTests == null)
            {
                return(config);
            }

            foreach (var abTestElement in languageJson.abTests)
            {
                config.Id          = ConvertDynamicValue <string>(abTestElement.ID);
                config.Name        = ConvertDynamicValue <string>(abTestElement.Name);
                config.Description = ConvertDynamicValue <string>(abTestElement.Description);

                if (abTestElement.testCasesSets == null)
                {
                    continue;
                }

                foreach (var testCaseSetElement in abTestElement.testCasesSets)
                {
                    var testCaseSet = new ABTestCaseSet(ConvertDynamicValue <string>(testCaseSetElement.id),
                                                        ConvertDynamicValue <string>(testCaseSetElement.brand),
                                                        ConvertDynamicValue <string>(testCaseSetElement.skin),
                                                        ConvertDynamicValue <string>(testCaseSetElement.lang));

                    if (testCaseSetElement.testCases == null)
                    {
                        continue;
                    }

                    foreach (var testCaseElement in testCaseSetElement.testCases)
                    {
                        var testCase = new ABTestCase(ConvertDynamicValue <string>(testCaseElement.ID),
                                                      ConvertDynamicValue <bool>(testCaseElement.isDefault),
                                                      ConvertDynamicValue <ABTestMethod>(testCaseElement.Method),
                                                      ConvertDynamicValue <string>(testCaseElement.Name),
                                                      ConvertDynamicValue <decimal>(testCaseElement.UsePercentage),
                                                      ConvertDynamicValue <string>(testCaseElement.Description),
                                                      new PathDescriptor(ConvertDynamicValue <string>(testCaseElement.ClientFolder)));


                        if (null != ((JObject)testCaseElement)?.Property("configurationPaths"))
                        {
                            if (null != ((JObject)testCaseElement.configurationPaths)?.Property("navigationPlanPath"))
                            {
                                testCase.FilesOverride.Add(new ABTestFileOverride(_defaultNavigationPlanPath, ConvertDynamicValue <string>(testCaseElement.configurationPaths.navigationPlanPath)));
                            }
                        }

                        testCaseSet.Add(testCase);
                    }

                    config.TestCaseSets.Add(testCaseSet);
                }
            }


            return(config);
        }
Exemple #10
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);
        }
Exemple #11
0
 private PathDescriptor ApplyAbTestCase(ABTestCase abTest, PathDescriptor path)
 {
     return(abTest?.GetOverrideFileOrNull(path, _skinCode)
            ?? path);
 }
Exemple #12
0
 public abstract PathDescriptor BuildLaunchUrl(ABTestCase abTest, EnvironmentConnection environmentConnection);
Exemple #13
0
        public string GetVersion(ABTestCase test)
        {
#warning in case of A/B test the version folder might be overriden
            return(Version);
        }
Exemple #14
0
 public ABTestCaseViewModel(ABTestCase abTestCase)
 {
     _abTestCase = abTestCase;
 }