Esempio n. 1
0
        public void TestEquality()
        {
            BVParameters bvParamObj1 = new BVParameters();

            bvParamObj1.UserAgent   = "googlebot";
            bvParamObj1.BaseURI     = "Example-Vector.jsp";
            bvParamObj1.PageURI     = "http://localhost/Example-Vector.jsp?someQuery=value1";
            bvParamObj1.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParamObj1.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParamObj1.SubjectId   = "1501";

            BVParameters bvParamObj2 = null;

            Assert.AreEqual <Boolean>(bvParamObj1.Equals(bvParamObj2), false, "object1 and object2 should not be equal");

            bvParamObj2 = bvParamObj1;
            Assert.AreEqual <Boolean>(bvParamObj1.Equals(bvParamObj2), true, "object1 and object2 should be equal");

            /*
             * Other object instance test
             */
            Assert.AreEqual <Boolean>(bvParamObj1.Equals("ABCD"), false, "object1 and someother should not be equal");

            bvParamObj2             = new BVParameters();
            bvParamObj2.UserAgent   = "msnbot";
            bvParamObj2.BaseURI     = "Example-Vector.jsp";
            bvParamObj2.PageURI     = "http://localhost/Example-Vector.jsp?someQuery=value1";
            bvParamObj2.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParamObj2.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParamObj2.SubjectId   = "1501";
            Assert.AreEqual <Boolean>(bvParamObj1.Equals(bvParamObj2), false, "object1 and object2 should not be equal");
        }
Esempio n. 2
0
        public void TestAggregate_InvalidURL()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();

            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "adobe-invalid-55d020998d7b4776fb0f9df49278083c");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "8814");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();

            _bvParam.UserAgent   = "google";
            _bvParam.BaseURI     = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI     = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId   = "PR6";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);

            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: The resource to the URL or file is currently unavailable.;</li>"),
                          "there should be error message for SubjectId");

            sBvOutputSummary = _bvOutput.getReviews(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: The resource to the URL or file is currently unavailable.;</li>"),
                          "there should be error message for SubjectId");

            sBvOutputSummary = _bvOutput.getContent(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: The resource to the URL or file is currently unavailable.;</li>"),
                          "there should be error message for SubjectId");
        }
Esempio n. 3
0
        public void TestSEOContentFromHTTP_SinglePagePRR_Reviews()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();

            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-69cb945801532dcfb57ad2b0d2471b68");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "3000");
            bvConfig.addProperty(BVClientConfig.STAGING, "true");

            BVUIContent uiContent = new BVManagedUIContent(bvConfig);

            BVParameters bvParameters = new BVParameters();

            bvParameters.UserAgent   = "google";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId   = "2000002";

            String theUIContent = uiContent.getReviews(bvParameters);

            Assert.AreEqual <Boolean>(theUIContent.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                                      "there should be reviews section in the content");
            Assert.AreEqual <Boolean>(!theUIContent.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                                      true, "there should not be AggregateRating in the content");
        }
Esempio n. 4
0
        public void TestAggregate_NullSubjectID()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();

            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "hartz-2605f8e4ef6790962627644cc195acf2");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "11568-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();

            _bvParam.UserAgent   = "google";
            _bvParam.BaseURI     = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI     = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId   = null;

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);

            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: SubjectId cannot be null or empty.;</li>"),
                          "there should be error message for SubjectId");

            sBvOutputSummary = _bvOutput.getReviews(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: SubjectId cannot be null or empty.;</li>"),
                          "there should be error message for SubjectId");

            sBvOutputSummary = _bvOutput.getContent(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: SubjectId cannot be null or empty.;</li>"),
                          "there should be error message for SubjectId");
        }
Esempio n. 5
0
        public void TestSEOContent_SinglePageHTTP_GetReview_SDK_Disabled()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();

            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "false");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "hartz-2605f8e4ef6790962627644cc195acf2");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "11568-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();

            _bvParam.UserAgent   = "google";
            _bvParam.BaseURI     = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI     = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId   = "1577";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getReviews(_bvParam);

            Console.WriteLine(sBvOutputSummary);
            Assert.AreEqual <Boolean>(sBvOutputSummary.Contains("<li data-bvseo=\"sdk\">"), true, "There should be footer");
            Assert.AreEqual <Boolean>(sBvOutputSummary.Contains("BVRRReviewsSoiSectionID"), false, "There should not be any reviews");
        }
Esempio n. 6
0
        public void TestSEOContent_SinglePageHTTP_Aggregate_WithoutPagination()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();

            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "totalgymdirect-f19e9cfeb9917d0c20afdfbe06483f1b");
            _bvConfig.addProperty(BVClientConfig.STAGING, "true");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();

            _bvParam.UserAgent   = "google";
            _bvParam.BaseURI     = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI     = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId   = "PRTG2000";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);

            Console.WriteLine(sBvOutputSummary);

            Assert.AreEqual <Boolean>(sBvOutputSummary.Contains("<!--begin-aggregate-rating-->"), true, "there should be AggregateRating in the content");
            Assert.AreEqual <Boolean>(!sBvOutputSummary.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                                      "there should not be reviews section in the content");
        }
        public void TestSEOContentFromFile_SinglePage_FileUnavailableError_bvReveal()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();

            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "True");
            bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, @"E:\alpha-beta-invalid-\Seo_cyberduck\myshco-359c29d8a8cbe3822bc0d7c58cb9f9ca");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-359c29d8a8cbe3822bc0d7c58cb9f9ca");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "9344seob");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVUIContent uiContent = new BVManagedUIContent(bvConfig);

            BVParameters bvParameters = new BVParameters();

            bvParameters.UserAgent   = "google";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId   = "3000001_thisFiledoesNotExist";
            bvParameters.BaseURI     = "http://www.example.com/store/products/data-gen-696yl2lg1kurmqxn88fqif5y2/";
            bvParameters.PageURI     = "http://www.example.com/store/products/data-gen-696yl2lg1kurmqxn88fqif5y2?bvreveal=debug";

            String theUIContent = uiContent.getContent(bvParameters);

            Assert.AreEqual <Boolean>(!theUIContent.Contains("BVRRSourceID"), true, "there should not be BvRRSourceID in the content");
            Assert.AreEqual <Boolean>(theUIContent.Contains("The resource to the URL or file is currently unavailable."), true, "there should be resource unavailable message");
            Assert.AreEqual <Boolean>(theUIContent.Contains("debug"), true, "there should be debug message");
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();

            bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");         // use this as a kill switch
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false"); // set to false if using cloud-based content
            bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, "/");
            bvConfig.addProperty(BVClientConfig.STAGING, "false");                // set to true for staging environment data
            bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, "yandex");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "bodyglove-8e186f6e16e2d688784728b360df41c5");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVUIContent uiContent = new BVManagedUIContent(bvConfig);

            var bvParameters = new BVParameters
            {
                BaseURI = Request.Url.AbsoluteUri,
                PageURI = Request.Url.AbsoluteUri + "?bvpage=ctre/id50524/stp"
            };

            var theUiContent = uiContent.getContent(bvParameters);

            BVRRContainer.InnerHtml = theUiContent;
        }
        public void Test_Spotlights_QAProduction()
        {
            _bvConfiguration.addProperty(BVClientConfig.STAGING, "false");
            _bvConfiguration.addProperty(BVClientConfig.TESTING, "true");
            _bvUIContent = new BVManagedUIContent(_bvConfiguration);

            BVParameters bvParameters = new BVParameters();

            bvParameters.UserAgent   = "google";
            bvParameters.ContentType = new BVContentType(BVContentType.SPOTLIGHTS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.CATEGORY);

            bvParameters.SubjectId  = "category-3";
            bvParameters.BaseURI    = "http://www.example.com/store/products/reviews";
            bvParameters.PageURI    = "http://www.example.com/store/products/data-gen-696yl2lg1kurmqxn88fqif5y2/?utm_campaign=bazaarvoice&utm_medium=SearchVoice&utm_source=RatingsAndReviews&utm_content=Default&bvrrp=Main_Site-en_US/reviews/product/1/50524.htm";
            bvParameters.PageNumber = "1";
            String erroMessage = null;
            String content     = null;

            try
            {
                stopwatch.Restart();
                content = _bvUIContent.getContent(bvParameters);
                stopwatch.Stop();
            }
            catch (BVSdkException e)
            {
                erroMessage = e.getMessage();
            }
            Console.WriteLine(content);
            Assert.IsTrue(stopwatch.ElapsedMilliseconds <= CONTENT_RETRIEVAL_THRESHOLD, String.Format("Content retrieval time exceeded {0} milliseconds", CONTENT_RETRIEVAL_THRESHOLD));
            Assert.IsTrue(!content.Contains("<li data-bvseo=\"ms\">bvseo-msg:"));
            Assert.IsTrue(content.Contains("<li data-bvseo=\"ct_st\">SPOTLIGHTS"));
            Assert.IsFalse(content.Contains("HTTP 403 Forbidden"), "There should be valid content");
        }
        public void Test_InlinePage_Review()
        {
            BVParameters bvParameters = new BVParameters();

            bvParameters.UserAgent   = "google";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId   = "50524";
            bvParameters.BaseURI     = "http://www.example.com/store/products/reviews";
            bvParameters.PageURI     = "http://www.example.com/store/products/data-gen-696yl2lg1kurmqxn88fqif5y2/?utm_campaign=bazaarvoice&utm_medium=SearchVoice&utm_source=RatingsAndReviews&utm_content=Default&bvrrp=Main_Site-en_US/reviews/product/2/50524.htm";
            String erroMessage = null;
            String content     = null;

            try
            {
                stopwatch.Restart();
                content = _bvUIContent.getContent(bvParameters);
                stopwatch.Stop();
            }
            catch (BVSdkException e)
            {
                erroMessage = e.getMessage();
            }

            Assert.IsTrue(stopwatch.ElapsedMilliseconds <= CONTENT_RETRIEVAL_THRESHOLD, String.Format("Content retrieval time exceeded {0} milliseconds", CONTENT_RETRIEVAL_THRESHOLD));
            Assert.IsNull(erroMessage, "There should not be any errorMessage");
            Assert.IsNotNull(content, "There should be content to proceed further assertion!!");
            Assert.IsFalse(content.Contains("HTTP 403 Forbidden"), "There should be valid content");
        }
        public void Test_ExternalPage_Stories()
        {
            BVParameters bvParameters = new BVParameters();

            bvParameters.UserAgent   = "google";
            bvParameters.ContentType = new BVContentType(BVContentType.STORIES);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId   = "50524";
            bvParameters.PageNumber  = "2";
            String erroMessage = null;
            String content     = null;

            try
            {
                stopwatch.Restart();
                content = _bvUIContent.getContent(bvParameters);
                stopwatch.Stop();
            }
            catch (BVSdkException e)
            {
                erroMessage = e.getMessage();
            }

            Assert.IsTrue(stopwatch.ElapsedMilliseconds <= CONTENT_RETRIEVAL_THRESHOLD, String.Format("Content retrieval time exceeded {0} milliseconds", CONTENT_RETRIEVAL_THRESHOLD));
            Assert.IsNull(erroMessage, "There should not be any errorMessage");
            Assert.IsNotNull(content, "There should be content to proceed further assertion!!");
            Assert.IsFalse(content.Contains("HTTP 403 Forbidden"), "There should be valid content");
        }
        private void postProcess(BVParameters bvParameters)
        {
            bvFooter = new BVHTMLFooter(_bvConfiguration, bvParameters);
            message  = new StringBuilder();

            /*
             * Validator to check if all the bvParameters are valid.
             */
            bvParamValidator = new BVDefaultValidator();
            validationError  = bvParamValidator.validate(_bvConfiguration, bvParameters);

            if (!String.IsNullOrEmpty(validationError))
            {
                return;
            }

            reloadContent = bvParameters.Equals(this.bvParameters);

            if (!reloadContent)
            {
                this.bvParameters = bvParameters;

                bvSeoSdkUrl = new BVSeoSdkURLBuilder(_bvConfiguration, bvParameters);

                bvUiContentService = new BVUIContentServiceProvider(_bvConfiguration);
                bvUiContentService.setBVParameters(this.bvParameters);
                bvUiContentService.setBVSeoSdkUrl(bvSeoSdkUrl);
            }
            bvFooter.setBvSeoSdkUrl(bvSeoSdkUrl);
        }
Esempio n. 13
0
        public void TestSEOContent_SinglePageHTTP_AggregateRating_IfNotPresent()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();

            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "seo_sdk_testcase-159b6108bb11967e554a92c6a3c39cb3");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();

            _bvParam.UserAgent   = "google";
            _bvParam.BaseURI     = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI     = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId   = "5000002_No_Aggr_Rating";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            Console.WriteLine(_bvOutput);
            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);

            Console.WriteLine(sBvOutputSummary);
            Assert.AreEqual <Boolean>(!sBvOutputSummary.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                                      true, "there should not be AggregateRating in the content");
            Assert.AreEqual <Boolean>(!sBvOutputSummary.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                                      "there should not be reviews section in the content");
            String expectedMessage = BVMessageUtil.getMessage("ERR0012");

            Assert.AreEqual <Boolean>(sBvOutputSummary.Contains(expectedMessage),
                                      true, "Message does not contain expected message please test");
        }
        public void Test_PageNumber_C2013()
        {
            BVConfiguration bvConfiguration = new BVSdkConfiguration();

            bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfiguration.addProperty(BVClientConfig.CLOUD_KEY, "agileville-78B2EF7DE83644CAB5F8C72F2D8C8491");
            bvConfiguration.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfiguration.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            bvConfiguration.addProperty(BVClientConfig.STAGING, "true");

            BVUIContent bvUIContent = new BVManagedUIContent(bvConfiguration);

            BVParameters bvParameters = new BVParameters();

            bvParameters.UserAgent   = "google";
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.PageNumber  = "2";
            bvParameters.BaseURI     = "http://www.example.com/store/products/reviews";
            bvParameters.PageURI     =
                "http://www.example.com/store/products/data-gen-696yl2lg1kurmqxn88fqif5y2/?utm_campaign=bazaarvoice&utm_medium=SearchVoice&utm_source=RatingsAndReviews&utm_content=Default&bvpage=pg3/ctre/stp/iddata-gen-5zkafmln4wymhcfbp5u6hmv5q&bvreveal=debug";

            String content = bvUIContent.getContent(bvParameters);

            Assert.IsTrue(
                content.Contains("http://seo-stg.bazaarvoice.com/agileville-78B2EF7DE83644CAB5F8C72F2D8C8491/"
                                 + "Main_Site-en_US/reviews/product/2/data-gen-5zkafmln4wymhcfbp5u6hmv5q.htm"),
                "URL should be valid url");
            Assert.IsTrue(!content.Contains("The resource to the URL or file is currently unavailable"),
                          "resource not found or unavailable message should not be there");

            Debug.WriteLine(content);
        }
        /// <summary>
        /// Gets the complete Bazaarvoice SEO content
        /// </summary>
        /// <param name="bvParameters">Query Parameters of type BVParameters</param>
        /// <returns>Returns the complete Bazaarvoice SEO Content as String</returns>
        public String getContent(BVParameters bvParameters)
        {
            long startTime = TimeinMilliSeconds();

            postProcess(bvParameters);

            StringBuilder uiContent = null;

            if (String.IsNullOrEmpty(validationError))
            {
                if (bvUiContentService.isSdkEnabled())
                {
                    uiContent = bvUiContentService.executeCall(reloadContent);
                }
                else
                {
                    _logger.Info(BVMessageUtil.getMessage("MSG0003"));
                    uiContent = new StringBuilder();
                }
                bvFooter.addMessage(bvUiContentService.getMessage().ToString());
            }
            else
            {
                uiContent = new StringBuilder();
                bvFooter.addMessage(validationError);
            }

            bvFooter.setExecutionTime(TimeinMilliSeconds() - startTime);
            uiContent.Append(bvFooter.displayFooter("getContent"));

            return(uiContent.ToString());
        }
Esempio n. 16
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.");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            BVConfiguration bvConfig   = new BVSdkConfiguration();
            String          cloudKey   = Request.QueryString["cloudkey"];
            String          staging    = Request.QueryString["staging"];
            String          testing    = Request.QueryString["testing"];
            String          rootFolder = Request.QueryString["site"];
            String          subjectId  = "seller";

            if (cloudKey != null)
            {
                bvConfig.addProperty(BVClientConfig.CLOUD_KEY, cloudKey);
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "srd-testcustomer-1-c3a130de760b3105e75e8202cb22e541");
            }
            if (staging != null)
            {
                bvConfig.addProperty(BVClientConfig.STAGING, staging);
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.STAGING, "false");
            }
            if (testing != null)
            {
                bvConfig.addProperty(BVClientConfig.TESTING, testing);
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.TESTING, "true");
            }

            if (rootFolder != null)
            {
                bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, rootFolder);
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            }

            var bvParameters = new BVParameters
            {
                BaseURI =
                    Request.Url.ToString().Contains("?")
                        ? Request.Url.ToString().Substring(0, Request.Url.ToString().IndexOf("?"))
                        : Request.Url.ToString(),
                PageURI     = Request.Url.ToString(),
                ContentType = new BVContentType(BVContentType.REVIEWS),
                SubjectType = new BVSubjectType(BVSubjectType.SELLER),
                SubjectId   = subjectId
            };

            BVUIContent bvOutput = new BVManagedUIContent(bvConfig);

            BVSellerRatingsContainer.InnerHtml = bvOutput.getContent(bvParameters);
            BVSEOURL.InnerHtml = bvOutput.getUrl();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Helper             helper    = new Helper(Page.Request);
            BVSdkConfiguration config    = helper.GetConfiguration("myshco-69cb945801532dcfb57ad2b0d2471b68", "Main_Site-en_US");
            BVParameters       bvParams  = helper.GetParams("5000001", "p", "rp");
            BVManagedUIContent uiContent = new BVManagedUIContent(config);
            string             content   = uiContent.getContent(bvParams);

            bvrrContentContainer.InnerHtml = content;
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Helper             helper    = new Helper(Page.Request);
            BVSdkConfiguration config    = helper.GetConfiguration("myshco-3e3001e88d9c32d19a17cafacb81bec7", "9344");
            BVParameters       bvParams  = helper.GetParams("5000001", "p", "sy", "storiesgrid");
            BVManagedUIContent uiContent = new BVManagedUIContent(config);
            string             content   = uiContent.getContent(bvParams);

            bvrrContentContainer.InnerHtml = content;
        }
Esempio n. 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Helper             helper    = new Helper(Page.Request);
            BVSdkConfiguration config    = helper.GetConfiguration("myshco-126b543c32d9079f120a575ece25bad6", "9344ia");
            BVParameters       bvParams  = helper.GetParams("Retail", "c", "qp");
            BVManagedUIContent uiContent = new BVManagedUIContent(config);
            string             content   = uiContent.getContent(bvParams);

            bvrrContentContainer.InnerHtml = content;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Helper             helper    = new Helper(Page.Request);
            BVSdkConfiguration config    = helper.GetConfiguration("myshco-3e3001e88d9c32d19a17cafacb81bec7", "9344");
            BVParameters       bvParams  = helper.GetParams("5000001", "p", "re");
            BVManagedUIContent uiContent = new BVManagedUIContent(config);
            string             summary   = uiContent.getAggregateRating(bvParams);
            string             reviews   = uiContent.getReviews(bvParams);
            string             content   = uiContent.getContent(bvParams);

            bvrrSummaryContainer.InnerHtml = summary;
            bvrrReviewsContainer.InnerHtml = reviews;
            bvrrContentContainer.InnerHtml = content;
        }
Esempio n. 22
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.");
        }
        public void TestValidation_When_BVConfig_Is_Null()
        {
            bvConfig     = null;
            bvParams     = null;
            bvValidator  = new BVDefaultValidator();
            errorMessage = bvValidator.validate(bvConfig, bvParams);
            Assert.AreEqual <Boolean>(errorMessage.Contains("BVConfiguration is null, please set a valid BVConfiguration.;"), true, "Error Messages are different.");

            bvConfig     = new BVSdkConfiguration();
            bvParams     = new BVParameters();
            bvValidator  = new BVDefaultValidator();
            errorMessage = bvValidator.validate(bvConfig, bvParams);

            Assert.AreEqual <Boolean>(errorMessage.Contains("SubjectId cannot be null or empty.;"), true, "Error Messages are different.");
        }
Esempio n. 24
0
        /// <summary>
        /// Checks bvParameters to see whether we need to reveal debug information.
        /// </summary>
        /// <param name="bvParameters"></param>
        /// <returns>true when we have to reveal debug information, false otherwise</returns>
        public static Boolean isRevealDebugEnabled(BVParameters bvParameters)
        {
            Regex regex = new Regex(BVConstant.BVSTATE_REVEAL_DEBUG_REGEX);

            return
                (
                bvParameters != null &&
                bvParameters.PageURI != null &&
                (
                    // check for presence of bvreveal=debug
                    bvParameters.PageURI.Contains(BVConstant.BVREVEAL_DEBUG) ||
                    // check for reveal:debug in bvstate
                    regex.Match(bvParameters.PageURI).Success
                )
                );
        }
Esempio n. 25
0
        public void TestDisplayFooter()
        {
            BVConfiguration bvConfiguration = new BVSdkConfiguration();
            BVParameters    bvParameters    = new BVParameters();

            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            BVFooter bvFooter = new BVHTMLFooter(bvConfiguration, bvParameters);

            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("PRODUCT"), true, "the content string should match.");
            Assert.AreEqual <Boolean>(displayFooter.Contains("<li data-bvseo=seo.sdk.execution.timeout>"), false, "the content string should not match.");
        }
Esempio n. 26
0
        public BVHTMLFooter(BVConfiguration bvConfiguration, BVParameters bvParameters)
        {
            if (bvConfiguration == null)
            {
                _logger.Error(BVMessageUtil.getMessage("ERR0007"));
                throw new BVSdkException("ERR0007");
            }

            _bvConfiguration = bvConfiguration;
            _bvParameters    = bvParameters;

            _velocityEngine = new VelocityEngine();
            _velocityEngine.Init();

            messageList = new List <String>();
        }
Esempio n. 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Helper             helper    = new Helper(Page.Request);
            BVSdkConfiguration config    = helper.GetConfiguration("myshco-126b543c32d9079f120a575ece25bad6", "9344ia");
            BVParameters       bvParams  = helper.GetParams("5000001", "p", "sp");
            BVManagedUIContent uiContent = new BVManagedUIContent(config);

            config.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "12");
            bvParams.UserAgent = "google";
            bvParams.PageURI   = Request.Url.ToString() + "?bvpage=ctsp/stp/pg2";
            string summary = uiContent.getAggregateRating(bvParams);
            string reviews = uiContent.getReviews(bvParams);
            string content = uiContent.getContent(bvParams);

            bvrrSummaryContainer.InnerHtml = summary;
            bvrrReviewsContainer.InnerHtml = reviews;
            bvrrContentContainer.InnerHtml = content;
        }
Esempio n. 28
0
        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.");
        }
Esempio n. 29
0
        public BVParameters GetParams(string subjectId, string subjectType, string contentType, string subType = "")
        {
            string pageUrl = Request.Url.ToString();

            BVParameters bvParams = new BVParameters
            {
                BaseURI     = pageUrl.Contains("?") ? pageUrl.Substring(0, pageUrl.IndexOf("?")) : pageUrl,
                PageURI     = Request.Url.ToString(),
                UserAgent   = Request.UserAgent,
                SubjectId   = subjectId,
                SubjectType = new BVSubjectType(subjectType),
                ContentType = new BVContentType(contentType),
            };

            if (subjectType != "")
            {
                bvParams.ContentSubType = new BVContentSubType(subType);
            }

            return(bvParams);
        }
Esempio n. 30
0
        public void TestSEOContent_SinglePageHTTP_AggregateRatingAndReviewsWithbvrevealDebug()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();

            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-69cb945801532dcfb57ad2b0d2471b68");
            _bvConfig.addProperty(BVClientConfig.STAGING, "true");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "3000");

            BVParameters _bvParam = new BVParameters();

            _bvParam.UserAgent   = "googlebot";
            _bvParam.BaseURI     = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI     = "http://localhost:8080/abcd" + "?" + "bvreveal=debug&notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId   = "2000001";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);

            Assert.AreEqual <Boolean>(sBvOutputSummary.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                                      true, "there should be AggregateRating in the content");
            Assert.AreEqual <Boolean>(!sBvOutputSummary.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                                      "there should not be reviews section in the content");
            Assert.AreEqual <Boolean>(sBvOutputSummary.Contains("contentURL"),
                                      true, "there should be contentURL in the content");

            String sBvOutputReviews = _bvOutput.getReviews(_bvParam);

            Assert.AreEqual <Boolean>(sBvOutputReviews.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                                      "there should be reviews section in the content");
            Assert.AreEqual <Boolean>(!sBvOutputReviews.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                                      true, "there should not be AggregateRating in the content");
            Assert.AreEqual <Boolean>(sBvOutputSummary.Contains("contentURL"),
                                      true, "there should be contentURL in the content");
        }