public void TestSDKEnabled()
        {
            bvUIContentService = new BVUIContentServiceProvider(bvConfiguration);
            BVParameters bvParameters = null;

            bvUIContentService.setBVParameters(bvParameters);
            bool isSdkEnabled = bvUIContentService.isSdkEnabled();
            Assert.IsTrue(isSdkEnabled, "SDK enabled should be true here.");

            /** Disabled behavior check. **/
            bvConfiguration.addProperty(BVClientConfig.SEO_SDK_ENABLED, "False");
            bvParameters = new BVParameters();
            bvParameters.PageURI = "http://localhost:8080/sampleapp/thecontent.jsp?product=abc";
            BVSeoSdkUrl bvSeoSdkUrl = new BVSeoSdkURLBuilder(bvConfiguration, bvParameters);
            bvUIContentService = new BVUIContentServiceProvider(bvConfiguration);
            bvUIContentService.setBVParameters(bvParameters);
            bvUIContentService.setBVSeoSdkUrl(bvSeoSdkUrl);
            isSdkEnabled = bvUIContentService.isSdkEnabled();
            Assert.IsFalse(isSdkEnabled, "SDK enabled should be false here.");

            /** Disable SDK but upon bvreveal sdkEnabled should be true. **/
            bvConfiguration.addProperty(BVClientConfig.SEO_SDK_ENABLED, "False");
            bvParameters = new BVParameters();
            bvParameters.PageURI = "http://localhost:8080/sampleapp/thecontent.jsp?product=abc&bvreveal=debug";
            bvSeoSdkUrl = new BVSeoSdkURLBuilder(bvConfiguration, bvParameters);
            bvUIContentService = new BVUIContentServiceProvider(bvConfiguration);
            bvUIContentService.setBVParameters(bvParameters);
            bvUIContentService.setBVSeoSdkUrl(bvSeoSdkUrl);
            isSdkEnabled = bvUIContentService.isSdkEnabled();
            Assert.IsTrue(isSdkEnabled, "SDK enabled should be true here.");

            /** Disable SDK but upon reveal:debug in bvstate sdkEnabled should be true. **/
            bvConfiguration.addProperty(BVClientConfig.SEO_SDK_ENABLED, "False");
            bvParameters = new BVParameters();
            bvParameters.PageURI = "http://localhost:8080/sampleapp/thecontent.jsp?product=abc&bvstate=ct:q/pg:1/st:p/reveal:debug";
            bvSeoSdkUrl = new BVSeoSdkURLBuilder(bvConfiguration, bvParameters);
            bvUIContentService = new BVUIContentServiceProvider(bvConfiguration);
            bvUIContentService.setBVParameters(bvParameters);
            bvUIContentService.setBVSeoSdkUrl(bvSeoSdkUrl);
            isSdkEnabled = bvUIContentService.isSdkEnabled();
            Assert.IsTrue(isSdkEnabled, "SDK enabled should be true when bvstate has reveal:debug.");
        }
Ejemplo n.º 2
0
        public void TestDisplayFooter_URL_Debug_bvstate()
        {
            BVConfiguration bvConfiguration = new BVSdkConfiguration();
            bvConfiguration.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");

            BVParameters bvParameters = new BVParameters();
            bvParameters.PageURI = "http://localhost:8080/Sample/Example-1.jsp?bvstate=ct:r/id:id2/reveal:debug";
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectId = "id1";

            BVSeoSdkUrl _bvSeoSdkUrl = new BVSeoSdkURLBuilder(bvConfiguration, bvParameters);
            BVFooter bvFooter = new BVHTMLFooter(bvConfiguration, bvParameters);
            bvFooter.setBvSeoSdkUrl(_bvSeoSdkUrl);

            String displayFooter = bvFooter.displayFooter("getContent");
            Assert.AreEqual<Boolean>(displayFooter.Contains("CLOUD"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("REVIEWS"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("PRODUCT"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"contentURL\">http://seo.bazaarvoice.com"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"subjectId\">id2"), true, "the subjectId should match.");

            /** When loading from files it should not display URL. **/
            bvConfiguration = new BVSdkConfiguration();
            bvConfiguration.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "true");

            bvParameters = new BVParameters();
            bvParameters.PageURI = "http://localhost:8080/Sample/Example-1.jsp?bvstate=ct:r/id:id2/reveal:debug";
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectId = "id1";

            _bvSeoSdkUrl = new BVSeoSdkURLBuilder(bvConfiguration, bvParameters);
            bvFooter = new BVHTMLFooter(bvConfiguration, bvParameters);
            bvFooter.setBvSeoSdkUrl(_bvSeoSdkUrl);
            String contentUri = _bvSeoSdkUrl.seoContentUri().ToString();

            displayFooter = bvFooter.displayFooter("getContent");
            Console.WriteLine(displayFooter);
            Assert.AreEqual<Boolean>(displayFooter.Contains("LOCAL"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("REVIEWS"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("PRODUCT"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"contentURL\">http://seo.bazaarvoice.com"), false, "there should not be any url pattern.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"subjectId\">id2"), true, "the subjectId should match.");
        }
Ejemplo n.º 3
0
        public void TestDisplayFooter_Debug()
        {
            BVConfiguration bvConfiguration = new BVSdkConfiguration();
            bvConfiguration.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "true");

            BVParameters bvParameters = new BVParameters();
            bvParameters.PageURI = "http://localhost:8080/Sample/Example-1.jsp?bvreveal=debug";
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);

            BVSeoSdkUrl _bvSeoSdkUrl = new BVSeoSdkURLBuilder(bvConfiguration, bvParameters);
            BVFooter bvFooter = new BVHTMLFooter(bvConfiguration, bvParameters);
            bvFooter.setBvSeoSdkUrl(_bvSeoSdkUrl);

            String displayFooter = bvFooter.displayFooter("getContent");
            Console.WriteLine(displayFooter);
            Assert.AreEqual<Boolean>(displayFooter.Contains("LOCAL"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("REVIEWS"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("PRODUCT"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"loadSEOFilesLocally\">true</li>"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"productionS3Hostname\">seo.bazaarvoice.com</li>"), true, "seo.bazaarvoice.com should be present.");
        }
Ejemplo n.º 4
0
        public void TestDisplayFooter_Debug_Seller()
        {
            BVConfiguration bvConfiguration = new BVSdkConfiguration();

            BVParameters bvParameters = new BVParameters();
            bvParameters.PageURI = "http://localhost:8080/Sample/Example-1.jsp?bvreveal=debug";
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.SELLER);
            bvParameters.SubjectId = "seller";

            BVSeoSdkUrl _bvSeoSdkUrl = new BVSeoSdkURLBuilder(bvConfiguration, bvParameters);
            BVFooter bvFooter = new BVHTMLFooter(bvConfiguration, bvParameters);
            bvFooter.setBvSeoSdkUrl(_bvSeoSdkUrl);

            String displayFooter = bvFooter.displayFooter("getContent");
            Console.WriteLine(displayFooter);
            Assert.AreEqual<Boolean>(displayFooter.Contains("CLOUD"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("REVIEWS"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("SELLER"), true, "the content string should match.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"productionS3Hostname\">seo.bazaarvoice.com</li>"), false, "seo.bazaarvoice.com should not be present.");
            Assert.AreEqual<Boolean>(displayFooter.Contains("<li data-bvseo=\"stagingS3Hostname\">seo-stg.bazaarvoice.com</li>"), false, "seo-stg.bazaarvoice.com should not be present.");
        }