/// <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());
        }
Пример #2
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");
        }
Пример #3
0
        /// <summary>
        /// Get the Message for the ErrorCode
        /// </summary>
        /// <returns>Message as String</returns>
        public String getMessage()
        {
            if (!String.IsNullOrEmpty(errorCode))
            {
                return(BVMessageUtil.getMessage(errorCode));
            }

            return(base.Message);
        }
        public string LoadContent(Uri uri)
        {
            string content = null;

            try
            {
                var httpRequest = (HttpWebRequest)WebRequest.Create(uri);
                httpRequest.AutomaticDecompression = DecompressionMethods.GZip;
                httpRequest.Timeout          = ConnectionTimeout;
                httpRequest.ReadWriteTimeout = SocketTimeout;
                httpRequest.UserAgent        = UserAgent;
                if (!string.IsNullOrEmpty(ProxyHost) &&
                    !ProxyHost.Equals("none", StringComparison.InvariantCultureIgnoreCase))
                {
                    var proxy = new WebProxy(ProxyHost, ProxyPort);
                    httpRequest.Proxy = proxy;
                }

                var webResponse = (HttpWebResponse)httpRequest.GetResponse();
                using (var reader = new StreamReader(webResponse.GetResponseStream(), Encoding))
                {
                    content = reader.ReadToEnd();
                }
            }
            catch (ProtocolViolationException e)
            {
                Logger.Error(BVMessageUtil.getMessage("ERR0012"), e);
                throw new BVSdkException("ERR0012");
            }
            catch (IOException e)
            {
                Logger.Error(BVMessageUtil.getMessage("ERR0019"), e);
                throw new BVSdkException("ERR0019");
            }
            catch (WebException e)
            {
                Logger.Error(BVMessageUtil.getMessage("ERR0012"), e);
                throw new BVSdkException("ERR0012");
            }
            catch (Exception e)
            {
                Logger.Error(e.Message, e);
                throw new BVSdkException(e.Message);
            }

            var isValidContent = BVUtility.validateBVContent(content);

            if (!isValidContent)
            {
                Logger.Error(BVMessageUtil.getMessage("ERR0025"));
                throw new BVSdkException("ERR0025");
            }


            return(content);
        }
Пример #5
0
        /// <summary>
        ///     Returns an encoding associated with the specified code page name.
        /// </summary>
        /// <remarks>Defaults to <see cref="Encoding.UTF8"/></remarks>
        /// <param name="name">
        ///     The code page name of the preferred encoding. Any value returned by
        ///     <see cref="P:System.Text.Encoding.WebName" /> is a valid input.
        /// </param>
        /// <exception cref="T:System.ArgumentException">
        ///     <paramref name="name" /> is not a valid code page name.-or- The code page
        ///     indicated by <paramref name="name" /> is not supported by the underlying platform.
        /// </exception>
        /// <filterpriority>1</filterpriority>
        /// <returns>
        ///     The <see cref="T:System.Text.Encoding" /> associated with the specified code page.
        /// </returns>
        public static Encoding GetEncoding(string name)
        {
            var encoding = Encoding.UTF8;

            try
            {
                encoding = string.IsNullOrEmpty(name) ? Encoding.UTF8 : Encoding.GetEncoding(name);
            }
            catch (Exception e)
            {
                Logger.Error(BVMessageUtil.getMessage("ERR0024"), e);
            }
            return(encoding);
        }
        private Uri fileUri(String path)
        {
            String fileRoot = bvConfiguration.getProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT);

            if (String.IsNullOrEmpty(fileRoot))
            {
                _logger.Error(BVMessageUtil.getMessage("ERR0010"));
                throw new BVSdkException("ERR0010");
            }

            String fullFilePath = Path.GetFullPath(fileRoot + "/" + path);

            Uri fileUri = new Uri(fullFilePath);

            return(fileUri);
        }
Пример #7
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>();
        }
Пример #8
0
 public string LoadContent(Uri uri)
 {
     if (File.Exists(uri.AbsolutePath))
     {
         try
         {
             return(File.ReadAllText(uri.AbsolutePath, Encoding));
         }
         catch (IOException e)
         {
             Logger.Error(BVMessageUtil.getMessage("ERR0012"), e);
             throw new BVSdkException("ERR0012");
         }
         catch (Exception e)
         {
             Logger.Error(e.Message, e);
             throw new BVSdkException(e.Message);
         }
     }
     Logger.Error(BVMessageUtil.getMessage("ERR0012"));
     throw new BVSdkException("ERR0012");
 }
        private Uri httpUri(String path)
        {
            Boolean isStaging      = Boolean.Parse(bvConfiguration.getProperty(BVClientConfig.STAGING));
            Boolean isTesting      = Boolean.Parse(bvConfiguration.getProperty(BVClientConfig.TESTING));
            Boolean isHttpsEnabled = Boolean.Parse(bvConfiguration.getProperty(BVClientConfig.SSL_ENABLED));
            String  s3Hostname     = null;
            String  pathPrefix     = null;

            if (
                bvParameters.SubjectType.getCS2013Text().Equals(
                    BVSubjectType.SELLER,
                    StringComparison.OrdinalIgnoreCase
                    )
                &&
                bvParameters.ContentType.getContentType().Equals(
                    BVContentType.REVIEWS,
                    StringComparison.OrdinalIgnoreCase
                    )
                )
            {
                s3Hostname = BVConstant.SELLER_RATINGS_S3_HOSTNAME;
                pathPrefix = "/";
                if (isTesting)
                {
                    pathPrefix += isStaging ?
                                  BVConstant.ENVIRONMENT_TESTING_STAGING
                        :
                                  BVConstant.ENVIRONMENT_TESTING;
                }
                else
                {
                    pathPrefix += isStaging ?
                                  BVConstant.ENVIRONMENT_STAGING
                        :
                                  BVConstant.ENVIRONMENT_PROD;
                }
            }
            else
            {
                pathPrefix = "";
                if (isTesting)
                {
                    s3Hostname = isStaging ?
                                 bvConfiguration.getProperty(BVCoreConfig.TESTING_STAGING_S3_HOSTNAME)
                        :
                                 bvConfiguration.getProperty(BVCoreConfig.TESTING_PRODUCTION_S3_HOSTNAME);
                }
                else
                {
                    s3Hostname = isStaging ?
                                 bvConfiguration.getProperty(BVCoreConfig.STAGING_S3_HOSTNAME)
                        :
                                 bvConfiguration.getProperty(BVCoreConfig.PRODUCTION_S3_HOSTNAME);
                }
            }

            String     cloudKey = bvConfiguration.getProperty(BVClientConfig.CLOUD_KEY);
            String     urlPath  = pathPrefix + "/" + cloudKey + "/" + path;
            UriBuilder builder  = new UriBuilder();

            builder.Scheme = isHttpsEnabled ? "https" : "http";
            if (s3Hostname.Contains(":"))
            {
                string[] parameters = s3Hostname.Split(':');
                foreach (string parameter in parameters)
                {
                    int portnum;
                    if (!int.TryParse(parameter, out portnum))
                    {
                        s3Hostname = parameter;
                    }
                    else
                    {
                        builder.Port = portnum;
                    }
                }
            }
            builder.Host = s3Hostname;
            builder.Path = urlPath;
            try
            {
                return(builder.Uri);
            }
            catch (UriFormatException e)
            {
                _logger.Error(BVMessageUtil.getMessage("ERR0027"), e);
                throw new BVSdkException("ERR0027");
            }

            return(null);
        }
        /// <summary>
        ///     Executes the server side call or the file level Call within a specified execution timeout.
        ///     when reload is set true then it gives from the cache that was already executed in the previous call.
        /// </summary>
        /// <param name="reload">A Boolean value to determine whether to reload from cache</param>
        /// <returns>A StringBuilder object representing the Content</returns>
        public StringBuilder executeCall(bool reload)
        {
            if (reload)
            {
                return(new StringBuilder(_uiContent.ToString()));
            }

            /**
             * StringBuilder depends on Length to reference the position of the next character;
             * We can effectively clear the StringBuilder by resetting it's length to '0'.
             */
            _uiContent.Length = 0;

            var isWebCrawler        = false;
            var crawlerAgentPattern = _bvConfiguration.getProperty(BVClientConfig.CRAWLER_AGENT_PATTERN);
            var userAgent           = UserAgent;

            if (!string.IsNullOrEmpty(crawlerAgentPattern) && _bvParameters != null &&
                !string.IsNullOrEmpty(userAgent))
            {
                crawlerAgentPattern = ".*(" + crawlerAgentPattern + ").*";
                var pattern = new Regex(crawlerAgentPattern, RegexOptions.IgnoreCase);
                isWebCrawler = pattern.IsMatch(userAgent);
            }

            var executionTimeout = isWebCrawler
                ? long.Parse(_bvConfiguration.getProperty(BVClientConfig.EXECUTION_TIMEOUT_BOT))
                : long.Parse(_bvConfiguration.getProperty(BVClientConfig.EXECUTION_TIMEOUT));

            if (!isWebCrawler && executionTimeout <= 0)
            {
                _message.Append(BVMessageUtil.getMessage("MSG0004"));
                return(new StringBuilder());
            }

            if (isWebCrawler && executionTimeout < 100)
            {
                executionTimeout = 100;
                _message.Append(BVMessageUtil.getMessage("MSG0005"));
            }

            try
            {
                var fCallFinished = false;

                if (executionTimeout > 0)
                {
                    var contentLoader = IsContentFromFile
                        ? new FileContentLoader(_bvConfiguration)
                        : (IContentLoader) new HttpContentLoader(_bvConfiguration, UserAgent);
                    fCallFinished = RunWithTimeout(Call, TimeSpan.FromMilliseconds(executionTimeout), contentLoader);
                }

                if (!fCallFinished)
                {
                    _message.Append(string.Format(BVMessageUtil.getMessage("ERR0018"), executionTimeout));
                }
            }
            catch (ThreadInterruptedException e)
            {
                Logger.Error(e.Message, e);
                _message.Append(e.Message);
            }
            catch (ExecutionEngineException e)
            {
                Logger.Error(e.Message, e);
                _message.Append(e.Message);
            }
            catch (TimeoutException e)
            {
                var errorCode = isWebCrawler ? "ERR0026" : "ERR0018";
                Logger.Error(string.Format(BVMessageUtil.getMessage(errorCode), executionTimeout), e);
                _message.AppendFormat(BVMessageUtil.getMessage(errorCode), executionTimeout);
            }
            catch (Exception e)
            {
                Logger.Error(e.Message, e);
                throw new BVSdkException(e.Message);
            }

            return(new StringBuilder(_uiContent.ToString()));
        }
        /// <summary>
        /// Gets only the Reviews section of the Bazaarvoice SEO Content
        /// </summary>
        /// <param name="bvQueryParams">Query Parameters of type BVParameters</param>
        /// <returns>Returns the Reviews section of the Bazaarvoice SEO Content as String</returns>
        public String getReviews(BVParameters bvQueryParams)
        {
            int  startIndex;
            long startTime = TimeinMilliSeconds();

            postProcess(bvQueryParams);

            StringBuilder uiContent = null;

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

                startIndex = uiContent.ToString().IndexOf("<!--begin-aggregate-rating-->");

                if (startIndex == -1)
                {
                    if (bvUiContentService.getMessage().Length == 0 && bvUiContentService.isSdkEnabled())
                    {
                        String messageString = BVMessageUtil.getMessage("ERR0013");
                        _logger.Error(BVMessageUtil.getMessage("ERR0013"));
                        message.Append(messageString);
                    }
                }
                else
                {
                    String endReviews = "<!--end-aggregate-rating-->";
                    int    endIndex   = uiContent.ToString().IndexOf(endReviews) + endReviews.Length;
                    int    Length     = endIndex - startIndex;
                    uiContent.Remove(startIndex, Length);
                }
                bvFooter.addMessage(bvUiContentService.getMessage().ToString());
                bvFooter.addMessage(message.ToString());
            }
            else
            {
                uiContent = new StringBuilder();
                bvFooter.addMessage(validationError);
            }


            /*
             * Remove schema.org text from reviews if one exists
             * itemscope itemtype="http://schema.org/Product"
             */
            String schemaOrg = "itemscope itemtype=\"http://schema.org/Product\"";

            startIndex = uiContent.ToString().IndexOf(schemaOrg);
            if (startIndex != -1)
            {
                uiContent.Remove(startIndex, schemaOrg.Length);
            }

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

            return(uiContent.ToString());
        }
        /// <summary>
        /// Gets only the AggregateRating section of the Bazaarvoice SEO Content
        /// </summary>
        /// <param name="bvQueryParams">Query Parameters of type BVParameters</param>
        /// <returns>Returns the AggregateRating section of the Bazaarvoice SEO Content as String</returns>
        public String getAggregateRating(BVParameters bvQueryParams)
        {
            long startTime = TimeinMilliSeconds();

            postProcess(bvQueryParams);

            StringBuilder uiContent = null;

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

                int startIndex = uiContent.ToString().IndexOf("<!--begin-reviews-->");
                if (startIndex == -1)
                {
                    if (bvUiContentService.getMessage().Length == 0 && bvUiContentService.isSdkEnabled())
                    {
                        String messageString = BVMessageUtil.getMessage("ERR0003");
                        _logger.Error(BVMessageUtil.getMessage("ERR0003"));
                        message.Append(messageString);
                    }
                }
                else
                {
                    String endReviews = "<!--end-reviews-->";
                    int    endIndex   = uiContent.ToString().IndexOf(endReviews) + endReviews.Length;
                    int    Length     = endIndex - startIndex;
                    uiContent.Remove(startIndex, Length);

                    startIndex = uiContent.ToString().IndexOf("<!--begin-pagination-->");
                    if (startIndex != -1)
                    {
                        String endPagination = "<!--end-pagination-->";
                        endIndex = uiContent.ToString().IndexOf(endPagination) + endPagination.Length;
                        Length   = endIndex - startIndex;
                        uiContent.Remove(startIndex, Length);
                    }
                }
                bvFooter.addMessage(bvUiContentService.getMessage().ToString());
            }
            else
            {
                uiContent = new StringBuilder();
                bvFooter.addMessage(validationError);
            }


            bvFooter.addMessage(message.ToString());
            bvFooter.setExecutionTime(TimeinMilliSeconds() - startTime);
            uiContent.Append(bvFooter.displayFooter("getAggregateRating"));

            return(uiContent.ToString());
        }
Пример #13
0
        public void TestMessages()
        {
            /** Null message code **/
            String messageCode  = null;
            String message      = null;
            String errorMessage = null;

            try
            {
                message = BVMessageUtil.getMessage(messageCode);
            }
            catch (BVSdkException bvExc)
            {
                errorMessage = bvExc.getMessage();
            }
            Assert.IsNull(message, "message should be null here");
            Assert.IsNotNull(errorMessage, "There should be an error message in errorMessage");

            /*
             * Empty message code
             */
            messageCode  = "";
            errorMessage = null;
            try
            {
                message = BVMessageUtil.getMessage(messageCode);
            }
            catch (BVSdkException bvExc)
            {
                errorMessage = bvExc.getMessage();
            }
            Assert.IsNull(message, "message should be null here");
            Assert.IsNotNull(errorMessage, "There should be an error message in errorMessage");

            /*
             * Invalid message code
             */
            messageCode  = "INVALID_CODE";
            errorMessage = null;
            try
            {
                message = BVMessageUtil.getMessage(messageCode);
            }
            catch (BVSdkException bvExc)
            {
                errorMessage = bvExc.getMessage();
                Assert.Fail("There was an error please check the exception which should have not occured.");
            }
            Assert.AreEqual <string>(message, messageCode, "message should be same as messageCode");
            Assert.IsNull(errorMessage, "There should not be an error message in errorMessage");

            /*
             * Valid message code
             */
            messageCode  = "MSG0000";
            errorMessage = null;
            try
            {
                message = BVMessageUtil.getMessage(messageCode);
            }
            catch (BVSdkException bvExc)
            {
                errorMessage = bvExc.getMessage();
            }
            Assert.IsNotNull(message, "message should not be null.");
            Assert.IsNull(errorMessage, "There should not be an error message in errorMessage");
        }
Пример #14
0
        public void TestAdd_GetProperty()
        {
            BVConfiguration bvConfiguration    = new BVSdkConfiguration();
            String          actualErrorMessage = null;
            String          depZoneId          = null;
            String          actualDepZoneId    = null;

            /** Negative scenario. trying to add null value to existing value. **/
            try
            {
                bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId);
            }
            catch (BVSdkException e)
            {
                actualErrorMessage = e.getMessage();
            }
            Assert.AreEqual <string>(actualErrorMessage, BVMessageUtil.getMessage("ERR0006"), "Error message does not match.");

            /** Negative scenario. trying to add empty value. **/
            actualErrorMessage = null;
            actualDepZoneId    = null;
            depZoneId          = "";
            try
            {
                bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId);
            }
            catch (BVSdkException e)
            {
                actualErrorMessage = e.getMessage();
            }
            Assert.AreEqual <string>(actualErrorMessage, BVMessageUtil.getMessage("ERR0006"), "Error message does not match.");

            /** positive scenario. when adding valid value. **/
            actualErrorMessage = null;
            actualDepZoneId    = null;
            depZoneId          = "DEP_ZONE_ID";
            try
            {
                bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId);
            }
            catch (BVSdkException e)
            {
                actualErrorMessage = e.getMessage();
                Assert.Fail("There was an exception please fix the code so that the exception will not occur.");
            }
            Assert.IsNull(actualErrorMessage, "There should not be any error message.");
            actualDepZoneId = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER);
            Assert.AreEqual <string>(depZoneId, actualDepZoneId, "deployment zone id does not match");

            /** positive scenario. value overwrite. **/
            actualErrorMessage = null;
            actualDepZoneId    = null;
            depZoneId          = "DEP_ZONE_ID_OVERWRITE";
            try
            {
                bvConfiguration.addProperty(BVClientConfig.BV_ROOT_FOLDER, depZoneId);
            }
            catch (BVSdkException e)
            {
                actualErrorMessage = e.getMessage();
                Assert.Fail("There was an exception please fix the code so that the exception will not occur.");
            }
            Assert.IsNull(actualErrorMessage, "There should not be any error message.");
            actualDepZoneId = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER);
            Assert.AreEqual <string>(depZoneId, actualDepZoneId, "deployment zone id does not match");

            /** positive scenario : when trying to get non-existence property. **/
            String nonExistingProperty = bvConfiguration.getProperty("NON_EXISTING_PROPERTY");

            Assert.IsNull(nonExistingProperty, "the nonExistingProperty should be null.");
        }
        /// <summary>
        /// Method to validate bvConfiguration & bvParameters.
        /// </summary>
        /// <param name="bvConfiguration">The BVConfiguration Object to validate</param>
        /// <param name="bvParams">The BVParameters Object to validate</param>
        /// <returns>Errors as String if Invalid attributes are found</returns>
        public String validate(BVConfiguration bvConfiguration, BVParameters bvParams)
        {
            if (bvConfiguration == null)
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0007"));
                _logger.Error(BVMessageUtil.getMessage("ERR0007"));
                return(errorMessages.ToString());
            }

            if (bvParams == null)
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0011"));
                _logger.Error(BVMessageUtil.getMessage("ERR0011"));
                return(errorMessages.ToString());
            }

            Boolean loadSeoFilesLocally = Boolean.Parse(bvConfiguration.getProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY));

            if (loadSeoFilesLocally)
            {
                String localSeoFileRoot = bvConfiguration.getProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT);
                if (String.IsNullOrEmpty(localSeoFileRoot))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0010"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0010"));
                }
            }
            else
            {
                String cloudKey = bvConfiguration.getProperty(BVClientConfig.CLOUD_KEY);
                if (String.IsNullOrEmpty(cloudKey))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0020"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0020"));
                }
            }

            String rootFolder = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER);

            if (String.IsNullOrEmpty(rootFolder))
            {
                errorMessages.Append(BVMessageUtil.getMessage("ERR0021"));
                _logger.Error(BVMessageUtil.getMessage("ERR0021"));
            }

            Uri uri = null;

            if (bvParams.BaseURI != null)
            {
                try
                {
                    uri = new Uri(bvParams.BaseURI);
                }
                catch (UriFormatException e)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0023"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0023"), e);
                }
            }

            if (bvParams.PageURI != null)
            {
                try
                {
                    uri = new Uri(bvParams.PageURI);
                }
                catch (UriFormatException e)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0022"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0022"), e);
                }
            }

            if (String.IsNullOrEmpty(bvParams.PageURI) || !bvParams.PageURI.Contains("bvpage"))
            {
                if (String.IsNullOrEmpty(bvParams.SubjectId))
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0014"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0014"));
                }

                if (bvParams.SubjectType == null)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0016"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0016"));
                }

                if (bvParams.ContentType == null)
                {
                    errorMessages.Append(BVMessageUtil.getMessage("ERR0015"));
                    _logger.Error(BVMessageUtil.getMessage("ERR0015"));
                }
            }


            if (errorMessages.Length > 0)
            {
                _logger.Error("There is an error : " + errorMessages.ToString());
                return(errorMessages.ToString());
            }

            return(null);
        }