public void TestExecutionTimeout()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.STAGING, "true");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "agileville-78B2EF7DE83644CAB5F8C72F2D8C8491");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "2");

            BVUIContent uiContent = new BVManagedUIContent(bvConfig);

            BVParameters bvParameters = new BVParameters();
            bvParameters.UserAgent = "NORMAL_USER OR Browser userAgent";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId = "data-gen-7k694zcnd6gbnpv2v4e6mmd22";

            String theUiContent = uiContent.getContent(bvParameters);
            Assert.IsTrue(theUiContent.Contains("getContent"), "there should be getContent word/message");
            Assert.IsTrue(theUiContent.Contains("Execution timed out, exceeded"), 
                "there should be execution timeout message");

            uiContent = new BVManagedUIContent(bvConfig);
            theUiContent = uiContent.getReviews(bvParameters);
            Assert.IsTrue(theUiContent.Contains("getReviews"), "there should be getReviews word/message");
            Assert.IsTrue(theUiContent.Contains("Execution timed out, exceeded"),
                "there should be execution timeout message");

            uiContent = new BVManagedUIContent(bvConfig);
            theUiContent = uiContent.getAggregateRating(bvParameters);
            Debug.WriteLine(theUiContent);
            Assert.IsTrue(theUiContent.Contains("getAggregateRating"), "there should be getAggregateRating word/message");
            Assert.IsTrue(theUiContent.Contains(" Execution timed out, exceeded"),
                "there should be execution timeout message");
        }
コード例 #2
0
        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(),
                UserAgent = Request.UserAgent,
                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();
        }
コード例 #3
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", "stories");
     BVManagedUIContent uiContent = new BVManagedUIContent(config);
     string content = uiContent.getContent(bvParams);
     bvrrContentContainer.InnerHtml = content;
 }
コード例 #4
0
 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;
 }
コード例 #5
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", "qp");
     BVManagedUIContent uiContent = new BVManagedUIContent(config);
     string content = uiContent.getContent(bvParams);
     bvrrContentContainer.InnerHtml = content;
 }
コード例 #6
0
        public void TestWithoutProxy()
        {
            var bvConfig = GetCommonConfig();
            var uiContent = new BVManagedUIContent(bvConfig);
            var bvParameters = GetCommonParams();
            var theUiContent = uiContent.getContent(bvParameters);

            Assert.AreEqual(theUiContent.Contains("bvseo-reviewsSection"), true, "there should be bvseo-reviewsSection in the content");
            Assert.AreEqual(theUiContent.Contains("bvseo-msg: Connect to localhost:12345 timed out"), false,
                "there should not be connection a timed out message.");
        }
コード例 #7
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", "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;
 }
コード例 #8
0
        public void TestProxyImplementation_Failure()
        {
            var bvConfig = GetCommonConfig();
            bvConfig.addProperty(BVClientConfig.PROXY_HOST, "localhost");
            bvConfig.addProperty(BVClientConfig.PROXY_PORT, "12345");

            var uiContent = new BVManagedUIContent(bvConfig);
            var bvParameters = GetCommonParams();
            var theUiContent = uiContent.getContent(bvParameters);

            Assert.AreEqual(theUiContent.Contains("bvseo-reviewsSection"), false, "there should not be bvseo-reviewsSection in the content");
            Assert.AreEqual(theUiContent.Contains("bvseo-msg: Execution timed out"), true);
        }
コード例 #9
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;
 }
コード例 #10
0
        public void TestProxyImplementation_Success()
        {
            var listener = new HttpListener();
            listener.Prefixes.Add("http://+:12345/");
            listener.Start();
            IAsyncResult result = listener.BeginGetContext(new AsyncCallback(ListenerCallback), listener);

            var bvConfig = GetCommonConfig();
            bvConfig.addProperty(BVClientConfig.PROXY_HOST, "localhost");
            bvConfig.addProperty(BVClientConfig.PROXY_PORT, "12345");

            var uiContent = new BVManagedUIContent(bvConfig);
            var bvParameters = GetCommonParams();
            var theUiContent = uiContent.getContent(bvParameters);

            result.AsyncWaitHandle.WaitOne();
            Assert.AreEqual(theUiContent.Contains("bvseo-reviewsSection"), true, "there should be bvseo-reviewsSection in the content");
            Assert.AreEqual(theUiContent.Contains("bvseo-msg: Connect to localhost:12345 timed out"), false,
                "there should not be connection a timed out message.");
        }
コード例 #11
0
        public void TestSEOContentFromFile_SinglePagePRR()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "True");
            bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, @"C:\Test\seo_local_files\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 = "FireFox";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId = "3000001";

            String theUIContent = uiContent.getContent(bvParameters);
            Assert.AreEqual<Boolean>(theUIContent.Contains("BVRRSourceID"), true, "there should be BvRRSourceID in the content");
        }
コード例 #12
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 TestSEOContent_SinglePageHTTP_GetContent_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.getContent(_bvParam);

            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");
            Assert.AreEqual<Boolean>(sBvOutputSummary.Contains("<span itemprop=\"aggregateRating\" itemscope "), false, "There should not be any ratings");

        }
コード例 #14
0
        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 category = Request.QueryString["category"];
            String noBodySchema = Request.QueryString["noBodySchema"];
            String subjectId = "category-1";

            if (cloudKey != null)
            {
                bvConfig.addProperty(BVClientConfig.CLOUD_KEY, cloudKey);
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "spotlight-four-746e2fc1211dc8964560350c9f28b67a");
            }
            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");
            }

            if (category != null)
            {
                subjectId = category;
            }
            else
            {
                subjectId = "category-1";
            }

            if (noBodySchema == null)
            {
                pageBody.Attributes.Add("itemscope itemtype", "http://schema.org/WebPage");
            }

            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.SPOTLIGHTS),
                SubjectType = new BVSubjectType(BVSubjectType.CATEGORY),
                SubjectId = subjectId
            };

            BVUIContent bvOutput = new BVManagedUIContent(bvConfig);
            BVSpotlightsContainer.InnerHtml = bvOutput.getContent(bvParameters);
            BVSEOURL.InnerHtml = bvOutput.getUrl();
        }
コード例 #15
0
        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);
        }
コード例 #16
0
ファイル: Bv.cs プロジェクト: CPE-Umbraco/seo_sdk_dotnet
        public String getSeoWithSdk(HttpRequest request)
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, _seoKey);
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, _deploymentZoneId);

            if (_botDetection)
            {
                bvConfig.addProperty(BVClientConfig.BOT_DETECTION, "true");
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.BOT_DETECTION, "false");
            }

            if (!string.IsNullOrEmpty(_botRegexString))
            {
                bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, _botRegexString);
            }

            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, _timeoutMs.ToString());

            if (_staging)
            {
                bvConfig.addProperty(BVClientConfig.STAGING, "true");
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.STAGING, "false");
            }

            if (_includeDisplayIntegrationCode)
            {
                bvConfig.addProperty(BVClientConfig.INCLUDE_DISPLAY_INTEGRATION_CODE, "true");
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.INCLUDE_DISPLAY_INTEGRATION_CODE, "false");
            }

            if (!string.IsNullOrEmpty(_internalFilePath))
            {
                bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "true");
                bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, _internalFilePath);
            }
            else
            {
                bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            }

            String subjectID = _productId;
            
            if(string.IsNullOrEmpty(_pageUrl))
                _pageUrl = request.Url.ToString();

            if (String.IsNullOrEmpty(_userAgent))
                _userAgent = request.UserAgent;

            BVContentType _contentType = new BVContentType(BVContentType.REVIEWS);
            if (!string.IsNullOrEmpty(_bvProduct))
            {
                switch (_bvProduct)
                {
                    case "reviews":
                        _contentType = new BVContentType(BVContentType.REVIEWS);
                        break;
                    case "questions":
                        _contentType = new BVContentType(BVContentType.QUESTIONS);
                        break;
                    case "stories":
                        _contentType = new BVContentType(BVContentType.STORIES);
                        break;
                }
            }

            BVSubjectType _subjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            if (!string.IsNullOrEmpty(_productOrCategory))
            {
                switch (_productOrCategory)
                {
                    case "product":
                        _subjectType = new BVSubjectType(BVSubjectType.PRODUCT);
                        break;
                    case "category":
                        _subjectType = new BVSubjectType(BVSubjectType.CATEGORY);
                        break;
                    case "entry":
                        _subjectType = new BVSubjectType(BVSubjectType.ENTRY);
                        break;
                    case "detail":
                        _subjectType = new BVSubjectType(BVSubjectType.DETAIL);
                        break;
                }
            }

            BVParameters bvParam = new BVParameters();
            bvParam.UserAgent = _userAgent;
            bvParam.BaseURI = _pageUrl.Contains("?") ? _pageUrl.Substring(0, _pageUrl.IndexOf("?")) : _pageUrl;
            bvParam.PageURI = _pageUrl;
            bvParam.ContentType = _contentType;
            bvParam.SubjectType = _subjectType;
            bvParam.SubjectId = subjectID;

            BVUIContent bvOutput = new BVManagedUIContent(bvConfig);
            String outputContent = bvOutput.getContent(bvParam);

            return outputContent; 
        }
コード例 #17
0
        private void loadData(
            String currentUrl,
            String contentType,
            int index,
            HtmlGenericControl reviewSummaryControl,
            HtmlGenericControl reviewControl,
            HtmlGenericControl contentControl
        )
        {
            String cloudKey = Request.QueryString["cloudkey" + index];
            String staging = Request.QueryString["staging" + index];
            String testing = Request.QueryString["testing" + index];
            String rootFolder = Request.QueryString["site" + index];
            String subjectType = Request.QueryString["subjecttype" + index];
            String subjectId = Request.QueryString["subjectid" + index];

            if (subjectType != null)
            {
                subjectType = BVSubjectType.subjectType(subjectType);
            }
            // Separate defaulting Logic for spotlight vs non-spotlight content
            if (contentType.Equals(BVContentType.SPOTLIGHTS, StringComparison.OrdinalIgnoreCase))
            {
                if (subjectId == null)
                {
                    subjectId = "category-1";
                }
                if (cloudKey == null)
                {
                    cloudKey = "spotlight-four-746e2fc1211dc8964560350c9f28b67a";
                }
                if (staging == null)
                {
                    staging = "false";
                }
                if (testing == null)
                {
                    testing = "true";
                }
                if (rootFolder == null)
                {
                    rootFolder = "Main_Site-en_US";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.CATEGORY;
                }
            }
            else if (contentType.Equals(BVContentType.REVIEWS, StringComparison.OrdinalIgnoreCase))
            {
                if (subjectId == null)
                {
                    subjectId = "product1";
                }
                if (cloudKey == null)
                {
                    cloudKey = "spotlight-five-311f5a3337b8d5e0d817adb7af279b0a";
                }
                if (staging == null)
                {
                    staging = "true";
                }
                if (testing == null)
                {
                    testing = "false";
                }
                if (rootFolder == null)
                {
                    rootFolder = "Other_Zone-en_US";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.PRODUCT;
                }
            }
            else if (contentType.Equals(BVContentType.QUESTIONS, StringComparison.OrdinalIgnoreCase))
            {
                if (subjectId == null)
                {
                    subjectId = "data-gen-u2y505e9u1l65i43l6zz22ve6";
                }
                if (cloudKey == null)
                {
                    cloudKey = "agileville-78B2EF7DE83644CAB5F8C72F2D8C8491";
                }
                if (staging == null)
                {
                    staging = "true";
                }
                if (testing == null)
                {
                    testing = "false";
                }
                if (rootFolder == null)
                {
                    rootFolder = "Main_Site-en_US";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.PRODUCT;
                }
            }
            else
            {
                if (subjectId == null)
                {
                    subjectId = "test1";
                }
                if (cloudKey == null)
                {
                    cloudKey = "Allergan-09b83694534c0d1bcd24851e9e9d172f";
                }
                if (staging == null)
                {
                    staging = "true";
                }
                if (testing == null)
                {
                    testing = "false";
                }
                if (rootFolder == null)
                {
                    rootFolder = "8183-en_us";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.PRODUCT;
                }
            }

            // Setting up BVConfiguration and BVParameters
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, cloudKey);
            bvConfig.addProperty(BVClientConfig.STAGING, staging);
            bvConfig.addProperty(BVClientConfig.TESTING, testing);
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, rootFolder);
            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.CRAWLER_AGENT_PATTERN, "yandex");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "1500");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT_BOT, "2000");

            var bvParameters = new BVParameters
            {
                BaseURI = currentUrl,
                PageURI = currentUrl,
                UserAgent = Request.UserAgent,
                ContentType = new BVContentType(contentType),
                SubjectType = new BVSubjectType(subjectType),
                SubjectId = subjectId
            };
            if (contentType.Equals(BVContentType.STORIES, StringComparison.OrdinalIgnoreCase))
            {
                bvParameters.ContentSubType = new BVContentSubType(BVContentSubType.STORIES_LIST);
            }

            BVUIContent bvOutput = new BVManagedUIContent(bvConfig);
            if (contentType.Equals(BVContentType.REVIEWS, StringComparison.OrdinalIgnoreCase))
            {
                reviewSummaryControl.InnerHtml = bvOutput.getAggregateRating(bvParameters);
                reviewControl.InnerHtml = bvOutput.getReviews(bvParameters);
                contentControl.InnerHtml = "";
            }
            else
            {
                contentControl.InnerHtml = bvOutput.getContent(bvParameters);
                reviewSummaryControl.InnerHtml = "";
                reviewControl.InnerHtml = "";
            }
        }
コード例 #18
0
        public void BVManagedUIContentTestPagination()
        {
            //Establish a new BVConfiguration.  Properties within this configuration are typically set in bvconfig.properties.
            //addProperty can be used to override configurations set in bvconfig.properties.
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");  // use this as a kill switch

            //this SDK supports retrieval of SEO contents from the cloud or local file system
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false"); // set to false if using cloud-based content
            _bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, "/");
            //if LOAD_SEO_FILES_LOCALLY = false, configure CLOUD_KEY and STAGING
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "totalgymdirect-f19e9cfeb9917d0c20afdfbe06483f1b"); // get this value from BV
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");  // set to true for staging environment data
            _bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, "yandex");

            //insert root folder with the value provided.
            //if multiple deployment zones/display codes are used for this implementation, use conditional logic to set the appropriate BV_ROOT_FOLDER
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US"); //get this value from BV
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");


            //Create BVParameters for each injection.  If the page contains multiple injections, for example //reviews and questions, set unique parameters for each injection.
            BVParameters _bvParam = new BVParameters();
            _bvParam.UserAgent = "yandex";
            _bvParam.BaseURI = "http://localhost:8080/Sample/Example-Adobe.jsp"; // this value is pagination links
            _bvParam.PageURI = "http://localhost:8080/Sample/Example-Adobe.jsp?bvrrp=8814/reviews/product/4/PR6.htm&bvreveal=debug"; //this should be the current page, full URL
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = "PRTG2000";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputReviews = _bvOutput.getContent(_bvParam); //String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);
            Console.WriteLine(sBvOutputReviews);
            Assert.AreEqual<Boolean>(sBvOutputReviews.Contains("bvseo-4"), true, "there should be BVRRSelectedPageNumber as 4 in the content");
        }
コード例 #19
0
        public void TestSEOContentFromHTTP__InvalidCloudKey()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "bodyglove_bad_URL-8e186f6e16e2d688784728b360df41c5");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            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 = "50524";

            String theUIContent = uiContent.getContent(bvParameters);
            Assert.AreEqual<Boolean>(!theUIContent.Contains("bvseo-reviewsSection"), true, "there should not be bvseo-reviewsSection 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");
        }
コード例 #20
0
        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");
        }
コード例 #21
0
        public void TestSEOContentFromFile_SinglePageC2013()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "True");
            bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, @"C:\Test\seo_local_files\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 = "FireFox";
            bvParameters.PageURI = "http://localhost:8080/sample/someproduct.jsp?bvpage=ctre/id3000001/stp";

            String theUIContent = uiContent.getContent(bvParameters);
            Console.WriteLine(theUIContent);
            Assert.AreEqual<Boolean>(theUIContent.Contains("BVRRSourceID"), true, "there should be BvRRSourceID in the content");
        }
        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");
        }
        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");
        }
コード例 #24
0
        public void TestSearchContentNullBVQueryParams()
        {
            BVUIContent bvUIContent = new BVManagedUIContent();
		    String bvContent = null;
		
		    bvContent = bvUIContent.getContent(null);
			Assert.IsTrue(bvContent.Contains("<li data-bvseo=\"ms\">bvseo-msg: BVParameters is null.;</li>"), "Message are not same please verify.");
        }
コード例 #25
0
        public void BVManagedUIContentTestBotExecutionTimeOut()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-359c29d8a8cbe3822bc0d7c58cb9f9ca");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "9344seob");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "1");

            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";

            String theUIContent = uiContent.getContent(bvParameters);
            Console.WriteLine(theUIContent);

            Assert.AreNotEqual<bool>(theUIContent.Contains("Execution timed out, exceeded"), true, "there should be execution timeout message");
        }
コード例 #26
0
        public void TestSEOContentFrom_Using_HTTPS()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.SSL_ENABLED, "true");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-69cb945801532dcfb57ad2b0d2471b68");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "6000");
            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 = "12345";
            bvParameters.PageURI = "http://localhost:8080/sample/xyz.jsp";

            String theUIContent = uiContent.getContent(bvParameters);
            Assert.AreEqual<Boolean>(theUIContent.Contains("bvseo-reviewsSection"), true, "there should be bvseo-reviewsSection in the content");
        }